api

package
v0.0.0-...-98d7a41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package api provides a high-level interface to the Azure NetApp Files SDK

Package api provides a high-level interface to the Azure NetApp Files SDK

Index

Constants

View Source
const (
	VolumeCreateTimeout        = 2 * time.Second
	SubvolumeCreateTimeout     = 10 * time.Second
	SnapshotTimeout            = 240 * time.Second // Snapshotter sidecar has a timeout of 5 minutes.  Stay under that!
	DefaultTimeout             = 120 * time.Second
	MaxLabelLength             = 256
	DefaultSDKTimeout          = 30 * time.Second
	DefaultSubvolumeSDKTimeout = 15 * time.Second
	SDKRetryDelay              = 2 * time.Second
	SDKMaxRetryDelay           = 15 * time.Second
	CorrelationIDHeader        = "X-Ms-Correlation-Request-Id"
	SubvolumeNameSeparator     = "-file-"
	PoolSizeTooSmallError      = "PoolSizeTooSmall"
)
View Source
const (
	PServiceLevel      = "serviceLevel"
	PVirtualNetwork    = "virtualNetwork"
	PSubnet            = "subnet"
	PResourceGroups    = "resourceGroups"
	PNetappAccounts    = "netappAccounts"
	PCapacityPools     = "capacityPools"
	DefaultMaxCacheAge = 10 * time.Minute
)
View Source
const (
	StateAccepted  = "Accepted"
	StateCreating  = "Creating"
	StateAvailable = "Succeeded"
	StateDeleting  = "Deleting"
	StateDeleted   = "NoSuchState"
	StateMoving    = "Moving" // Currently unused by ANF
	StateError     = "Failed"
	StateReverting = "Reverting"

	ProtocolTypeNFSPrefix = "NFSv"
	ProtocolTypeNFSv3     = ProtocolTypeNFSPrefix + "3"
	ProtocolTypeNFSv41    = ProtocolTypeNFSPrefix + "4.1"
	ProtocolTypeCIFS      = "CIFS"

	MountOptionKerberos5  = "sec=krb5"
	MountOptionKerberos5I = "sec=krb5i"
	MountOptionKerberos5P = "sec=krb5p"

	ServiceLevelStandard = "Standard"
	ServiceLevelPremium  = "Premium"
	ServiceLevelUltra    = "Ultra"

	FeatureUnixPermissions = "ANFUnixPermissions"

	NetworkFeaturesBasic    = "Basic"
	NetworkFeaturesStandard = "Standard"
)

Variables

View Source
var (
	VolumePollerCache = AzurePollerResponseCache{/* contains filtered or unexported fields */}
)

Functions

func CreateCapacityPoolFullName

func CreateCapacityPoolFullName(resourceGroup, netappAccount, capacityPool string) string

CreateCapacityPoolFullName creates the fully qualified name for a capacity pool.

func CreateNetappAccountFullName

func CreateNetappAccountFullName(resourceGroup, netappAccount string) string

CreateNetappAccountFullName creates the fully qualified name for a netapp account.

func CreateNetappAccountID

func CreateNetappAccountID(subscriptionID, resourceGroup, netappAccount string) string

CreateNetappAccountID creates the Azure-style ID for a netapp account.

func CreateSnapshotFullName

func CreateSnapshotFullName(resourceGroup, netappAccount, capacityPool, volume, snapshot string) string

CreateSnapshotFullName creates the fully qualified name for a snapshot.

func CreateSnapshotID

func CreateSnapshotID(
	subscriptionID, resourceGroup, netappAccount, capacityPool, volume, snapshot string,
) string

CreateSnapshotID creates the Azure-style ID for a snapshot.

func CreateStringPtrArray

func CreateStringPtrArray(in []string) []*string

CreateStringPtrArray accepts an array of strings and returns an array of pointers to those strings.

func CreateSubnetFullName

func CreateSubnetFullName(resourceGroup, virtualNetwork, subnet string) string

CreateSubnetFullName creates the fully qualified name for a subnet.

func CreateSubnetID

func CreateSubnetID(subscriptionID, resourceGroup, vNet, subnet string) string

CreateSubnetID creates the Azure-style ID for a subnet.

func CreateSubvolumeFullName

func CreateSubvolumeFullName(resourceGroup, netappAccount, capacityPool, volume, subvolume string) string

CreateSubvolumeFullName creates the fully qualified name for a subvolume.

func CreateSubvolumeID

func CreateSubvolumeID(
	subscriptionID, resourceGroup, netappAccount, capacityPool, volume, subvolume string,
) string

CreateSubvolumeID creates the Azure-style ID for a subvolume.

func CreateVirtualNetworkFullName

func CreateVirtualNetworkFullName(resourceGroup, virtualNetwork string) string

CreateVirtualNetworkFullName creates the fully qualified name for a virtual network.

func CreateVirtualNetworkID

func CreateVirtualNetworkID(subscriptionID, resourceGroup, virtualNetwork string) string

CreateVirtualNetworkID creates the Azure-style ID for a virtual network.

func CreateVolumeFullName

func CreateVolumeFullName(resourceGroup, netappAccount, capacityPool, volume string) string

CreateVolumeFullName creates the fully qualified name for a volume.

func CreateVolumeID

func CreateVolumeID(subscriptionID, resourceGroup, netappAccount, capacityPool, volume string) string

CreateVolumeID creates the Azure-style ID for a volume.

func DerefBool

func DerefBool(b *bool) bool

DerefBool accepts a bool pointer and returns the value of the bool, or false if the pointer is nil.

func DerefInt32

func DerefInt32(i *int32) int32

DerefInt32 accepts an int32 pointer and returns the value of the int32, or 0 if the pointer is nil.

func DerefInt64

func DerefInt64(i *int64) int64

DerefInt64 accepts an int64 pointer and returns the value of the int64, or 0 if the pointer is nil.

func DerefNetworkFeatures

func DerefNetworkFeatures(f *netapp.NetworkFeatures) string

DerefNetworkFeatures accepts a NetworkFeatures pointer and returns its string value, or "" if the pointer is nil.

func DerefString

func DerefString(s *string) string

DerefString accepts a string pointer and returns the value of the string, or "" if the pointer is nil.

func DerefStringArray

func DerefStringArray(s *[]string) []string

DerefStringArray accepts a string array pointer and returns the value of the array, or []string if the pointer is nil.

func DerefStringPtrArray

func DerefStringPtrArray(in []*string) []string

DerefStringPtrArray accepts an array of string pointers and returns the value of the array.

func GetAzureCredential

func GetAzureCredential(config ClientConfig) (credential azcore.TokenCredential, err error)

func GetCorrelationID

func GetCorrelationID(response *http.Response) (id string)

GetCorrelationID accepts an HTTP response returned from the ANF SDK and extracts the correlation header, if present.

func GetCorrelationIDFromError

func GetCorrelationIDFromError(err error) (id string)

GetCorrelationIDFromError accepts an error returned from the ANF SDK and extracts the correlation header, if present.

func GetMessageFromError

func GetMessageFromError(ctx context.Context, inputErr error) error

GetMessageFromError accepts an error returned from the ANF SDK and returns an appropriate error message.

func IsANFNotFoundError

func IsANFNotFoundError(err error) bool

IsANFNotFoundError checks whether an error returned from the ANF SDK contains a 404 (Not Found) error.

func IsANFPoolSizeTooSmallError

func IsANFPoolSizeTooSmallError(ctx context.Context, inputErr error) (bool, error)

IsANFPoolSizeTooSmallError checks whether an error returned from the ANF SDK contains a PoolSizeToolSmall code

func IsANFTooManyRequestsError

func IsANFTooManyRequestsError(err error) bool

IsANFTooManyRequestsError checks whether an error returned from the ANF SDK contains a 429 (Too Many Requests) error.

func IsTerminalStateError

func IsTerminalStateError(err error) bool

func ParseCapacityPoolID

func ParseCapacityPoolID(
	capacityPoolID string,
) (subscriptionID, resourceGroup, provider, netappAccount, capacityPool string, err error)

ParseCapacityPoolID parses the Azure-style ID for a capacity pool.

func ParseSnapshotID

func ParseSnapshotID(
	snapshotID string,
) (subscriptionID, resourceGroup, provider, netappAccount, capacityPool, volume, snapshot string, err error)

ParseSnapshotID parses the Azure-style ID for a snapshot.

func ParseSubnetID

func ParseSubnetID(
	subnetID string,
) (subscriptionID, resourceGroup, provider, virtualNetwork, subnet string, err error)

ParseSubnetID parses the Azure-style ID for a subnet.

func ParseSubvolumeID

func ParseSubvolumeID(
	subvolumeID string,
) (subscriptionID, resourceGroup, provider, netappAccount, capacityPool, volume, subvolume string, err error)

ParseSubvolumeID parses the Azure-style ID for a subvolume.

func ParseVolumeID

func ParseVolumeID(
	volumeID string,
) (subscriptionID, resourceGroup, provider, netappAccount, capacityPool, volume string, err error)

ParseVolumeID parses the Azure-style ID for a volume.

func ParseVolumeName

func ParseVolumeName(volumeName string) (resourceGroup, netappAccount, capacityPool, volume string, err error)

ParseVolumeName parses the Azure-style Name for a volume.

Types

type Azure

type Azure interface {
	Init(context.Context, map[string]storage.Pool) error

	RefreshAzureResources(context.Context) error
	DiscoverAzureResources(context.Context) error
	EnableAzureFeatures(context.Context, ...string) error
	Features() map[string]bool
	HasFeature(string) bool
	CapacityPools() *[]*CapacityPool
	CapacityPoolsForStoragePools(context.Context) []*CapacityPool
	CapacityPoolsForStoragePool(context.Context, storage.Pool, string) []*CapacityPool
	EnsureVolumeInValidCapacityPool(context.Context, *FileSystem) error
	SubnetsForStoragePool(context.Context, storage.Pool) []*Subnet
	RandomSubnetForStoragePool(context.Context, storage.Pool) *Subnet
	FilteredCapacityPoolMap(ctx context.Context, rgFilter, naFilter, cpFilter []string) map[string]*CapacityPool
	FilteredSubnetMap(ctx context.Context, rgFilter []string, vnFilter, snFilter string) map[string]*Subnet

	Volumes(context.Context) (*[]*FileSystem, error)
	Volume(context.Context, *storage.VolumeConfig) (*FileSystem, error)
	VolumeExists(context.Context, *storage.VolumeConfig) (bool, *FileSystem, error)
	VolumeByCreationToken(context.Context, string) (*FileSystem, error)
	VolumeExistsByCreationToken(context.Context, string) (bool, *FileSystem, error)
	VolumeByID(context.Context, string) (*FileSystem, error)
	VolumeExistsByID(context.Context, string) (bool, *FileSystem, error)
	WaitForVolumeState(context.Context, *FileSystem, string, []string, time.Duration, Operation) (string, error)
	CreateVolume(context.Context, *FilesystemCreateRequest) (*FileSystem, error)
	ModifyVolume(context.Context, *FileSystem, map[string]string, *string, *bool, *ExportRule) error
	ResizeVolume(context.Context, *FileSystem, int64) error
	DeleteVolume(context.Context, *FileSystem) error

	Subvolumes(context.Context, []string) (*[]*Subvolume, error)
	Subvolume(context.Context, *storage.VolumeConfig, bool) (*Subvolume, error)
	SubvolumeExists(context.Context, *storage.VolumeConfig, []string) (bool, *Subvolume, error)
	SubvolumeByCreationToken(context.Context, string, []string, bool) (*Subvolume, error)
	SubvolumeExistsByCreationToken(context.Context, string, []string) (bool, *Subvolume, error)
	SubvolumeByID(context.Context, string, bool) (*Subvolume, error)
	SubvolumeExistsByID(context.Context, string) (bool, *Subvolume, error)
	SubvolumeParentVolume(context.Context, *storage.VolumeConfig) (*FileSystem, error)
	WaitForSubvolumeState(context.Context, *Subvolume, string, []string, time.Duration) (string, error)
	CreateSubvolume(context.Context, *SubvolumeCreateRequest) (*Subvolume, PollerResponse, error)
	ResizeSubvolume(context.Context, *Subvolume, int64) error
	DeleteSubvolume(context.Context, *Subvolume) (PollerResponse, error)
	ValidateFilePoolVolumes(context.Context, []string) ([]*FileSystem, error)

	SnapshotsForVolume(context.Context, *FileSystem) (*[]*Snapshot, error)
	SnapshotForVolume(context.Context, *FileSystem, string) (*Snapshot, error)
	WaitForSnapshotState(context.Context, *Snapshot, *FileSystem, string, []string, time.Duration) error
	CreateSnapshot(context.Context, *FileSystem, string) (*Snapshot, error)
	RestoreSnapshot(context.Context, *FileSystem, *Snapshot) error
	DeleteSnapshot(context.Context, *FileSystem, *Snapshot) error
}

func NewDriver

func NewDriver(config ClientConfig) (Azure, error)

NewDriver is a factory method for creating a new SDK interface.

type AzureClient

type AzureClient struct {
	Credential       azcore.TokenCredential
	FeaturesClient   *features.Client
	GraphClient      *resourcegraph.Client
	VolumesClient    *netapp.VolumesClient
	SnapshotsClient  *netapp.SnapshotsClient
	SubvolumesClient *netapp.SubvolumesClient
	AzureResources
}

AzureClient holds operational Azure SDK objects.

type AzureError

type AzureError struct {
	Id        string `json:"id"`
	Name      string `json:"name"`
	Status    string `json:"status"`
	StartTime string `json:"startTime"`
	EndTime   string `json:"endTime"`
	AzError   struct {
		Code    string `json:"code"`
		Message string `json:"message"`
		Details []struct {
			Code    string `json:"code"`
			Message string `json:"message"`
		} `json:"details"`
	} `json:"error"`
}

func (*AzureError) Error

func (e *AzureError) Error() string

type AzurePollerResponseCache

type AzurePollerResponseCache struct {
	// contains filtered or unexported fields
}

func (*AzurePollerResponseCache) Delete

func (azPollerCache *AzurePollerResponseCache) Delete(key PollerKey)

func (*AzurePollerResponseCache) Get

func (azPollerCache *AzurePollerResponseCache) Get(key PollerKey) (PollerResponse, bool)

func (*AzurePollerResponseCache) Put

func (azPollerCache *AzurePollerResponseCache) Put(key *PollerKey, value PollerResponse) error

type AzureResources

type AzureResources struct {
	ResourceGroups    []*ResourceGroup
	ResourceGroupMap  map[string]*ResourceGroup
	NetAppAccountMap  map[string]*NetAppAccount
	CapacityPoolMap   map[string]*CapacityPool
	VirtualNetworkMap map[string]*VirtualNetwork
	SubnetMap         map[string]*Subnet
	StoragePoolMap    map[string]storage.Pool
	Features          map[string]bool
	// contains filtered or unexported fields
}

AzureResources is the toplevel cache for the set of things we discover about our Azure environment.

type CapacityPool

type CapacityPool struct {
	ID                string
	ResourceGroup     string
	NetAppAccount     string
	Name              string
	FullName          string
	Location          string
	Type              string
	PoolID            string
	ServiceLevel      string
	ProvisioningState string
	QosType           string
}

CapacityPool records details of a discovered Azure Subnet.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client encapsulates connection details.

func (Client) CapacityPools

func (c Client) CapacityPools() *[]*CapacityPool

CapacityPools returns a list of all discovered ANF capacity pools.

func (Client) CapacityPoolsForStoragePool

func (c Client) CapacityPoolsForStoragePool(
	ctx context.Context, sPool storage.Pool, serviceLevel string,
) []*CapacityPool

CapacityPoolsForStoragePool returns all discovered capacity pools matching the specified storage pool and service level. The pools are shuffled to enable easier random selection.

func (Client) CapacityPoolsForStoragePools

func (c Client) CapacityPoolsForStoragePools(ctx context.Context) []*CapacityPool

CapacityPoolsForStoragePools returns all discovered capacity pools matching all known storage pools, regardless of service levels.

func (Client) CreateSnapshot

func (c Client) CreateSnapshot(ctx context.Context, filesystem *FileSystem, name string) (*Snapshot, error)

CreateSnapshot creates a new snapshot.

func (Client) CreateSubvolume

func (c Client) CreateSubvolume(ctx context.Context, request *SubvolumeCreateRequest) (*Subvolume, PollerResponse, error)

CreateSubvolume creates a new subvolume

func (Client) CreateVolume

func (c Client) CreateVolume(ctx context.Context, request *FilesystemCreateRequest) (*FileSystem, error)

CreateVolume creates a new volume.

func (Client) DeleteSnapshot

func (c Client) DeleteSnapshot(ctx context.Context, filesystem *FileSystem, snapshot *Snapshot) error

DeleteSnapshot deletes a snapshot.

func (Client) DeleteSubvolume

func (c Client) DeleteSubvolume(ctx context.Context, subvolume *Subvolume) (PollerResponse, error)

DeleteSubvolume deletes a subvolume.

func (Client) DeleteVolume

func (c Client) DeleteVolume(ctx context.Context, filesystem *FileSystem) error

DeleteVolume deletes a volume.

func (Client) DiscoverAzureResources

func (c Client) DiscoverAzureResources(ctx context.Context) (returnError error)

DiscoverAzureResources rediscovers the Azure resources we care about and updates the cache.

func (Client) EnableAzureFeatures

func (c Client) EnableAzureFeatures(ctx context.Context, featureNames ...string) (returnError error)

EnableAzureFeatures registers any ANF preview features we care about and updates the cache.

func (Client) EnsureVolumeInValidCapacityPool

func (c Client) EnsureVolumeInValidCapacityPool(ctx context.Context, volume *FileSystem) error

EnsureVolumeInValidCapacityPool checks whether the specified volume exists in any capacity pool that is referenced by the backend config. It returns nil if so, or if no capacity pools are named in the config.

func (Client) Features

func (c Client) Features() map[string]bool

Features returns the map of preview features believed to be available in the current subscription.

func (Client) FilteredCapacityPoolMap

func (c Client) FilteredCapacityPoolMap(
	ctx context.Context, rgFilter, naFilter, cpFilter []string,
) map[string]*CapacityPool

func (Client) FilteredSubnetMap

func (c Client) FilteredSubnetMap(
	ctx context.Context, rgFilter []string, vnFilter, snFilter string,
) map[string]*Subnet

func (Client) HasFeature

func (c Client) HasFeature(feature string) bool

HasFeature returns true if the named preview feature is believed to be available in the current subscription.

func (Client) Init

func (c Client) Init(ctx context.Context, pools map[string]storage.Pool) error

Init runs startup logic after allocating the driver resources.

func (Client) ModifyVolume

func (c Client) ModifyVolume(
	ctx context.Context, filesystem *FileSystem, labels map[string]string, unixPermissions *string, snapshotDirAccess *bool, exportRule *ExportRule,
) error

ModifyVolume updates attributes of a volume.

func (Client) RandomSubnetForStoragePool

func (c Client) RandomSubnetForStoragePool(ctx context.Context, sPool storage.Pool) *Subnet

RandomSubnetForStoragePool finds all discovered subnets matching the specified storage pool, and then returns one at random.

func (Client) RefreshAzureResources

func (c Client) RefreshAzureResources(ctx context.Context) error

RefreshAzureResources refreshes the cache of discovered Azure resources and validates them against our known storage pools.

func (Client) ResizeSubvolume

func (c Client) ResizeSubvolume(ctx context.Context, subvolume *Subvolume, newSizeBytes int64) error

ResizeSubvolume sends a SubvolumePatchRequest to update a subvolume's size.

func (Client) ResizeVolume

func (c Client) ResizeVolume(ctx context.Context, filesystem *FileSystem, newSizeBytes int64) error

ResizeVolume sends a VolumePatch to update a volume's quota.

func (Client) RestoreSnapshot

func (c Client) RestoreSnapshot(ctx context.Context, filesystem *FileSystem, snapshot *Snapshot) error

RestoreSnapshot restores a volume to a snapshot.

func (Client) SnapshotForVolume

func (c Client) SnapshotForVolume(
	ctx context.Context, filesystem *FileSystem, snapshotName string,
) (*Snapshot, error)

SnapshotForVolume fetches a specific snapshot on a volume by its name.

func (Client) SnapshotsForVolume

func (c Client) SnapshotsForVolume(ctx context.Context, filesystem *FileSystem) (*[]*Snapshot, error)

SnapshotsForVolume returns a list of snapshots on a volume.

func (Client) SubnetsForStoragePool

func (c Client) SubnetsForStoragePool(ctx context.Context, sPool storage.Pool) []*Subnet

SubnetsForStoragePool returns all discovered subnets matching the specified storage pool.

func (Client) Subvolume

func (c Client) Subvolume(
	ctx context.Context, volConfig *storage.VolumeConfig, queryMetadata bool,
) (*Subvolume, error)

Subvolume uses a volume config record to fetch a subvolume by the most efficient means.

func (Client) SubvolumeByCreationToken

func (c Client) SubvolumeByCreationToken(
	ctx context.Context, creationToken string, candidateFileVolumePools []string, queryMetadata bool,
) (*Subvolume, error)

SubvolumeByCreationToken fetches a Subvolume by its creation token. We can't query the SDK for subvolume by creation token, so our only choice here is to check for subvolume presence in each of the volume. That is obviously very inefficient, so this method should be used only when absolutely necessary.

func (Client) SubvolumeByID

func (c Client) SubvolumeByID(ctx context.Context, subvolumeID string, queryMetadata bool) (*Subvolume, error)

SubvolumeByID returns a Subvolume based on its Azure-style ID.

func (Client) SubvolumeExists

func (c Client) SubvolumeExists(
	ctx context.Context, volConfig *storage.VolumeConfig, candidateFileVolumePools []string,
) (bool, *Subvolume, error)

SubvolumeExists uses a volume config record to look for a Subvolume by the most efficient means.

func (Client) SubvolumeExistsByCreationToken

func (c Client) SubvolumeExistsByCreationToken(
	ctx context.Context, creationToken string, candidateFileVolumePools []string,
) (bool, *Subvolume, error)

SubvolumeExistsByCreationToken checks whether a subvolume exists using its creation token as a key.

func (Client) SubvolumeExistsByID

func (c Client) SubvolumeExistsByID(ctx context.Context, id string) (bool, *Subvolume, error)

SubvolumeExistsByID checks whether a subvolume exists using its creation token as a key.

func (Client) SubvolumeMetadata

func (c Client) SubvolumeMetadata(ctx context.Context, subvolume *Subvolume) (*Subvolume, error)

SubvolumeMetadata fetches a Subvolume metadata, melds it into the supplied subvolume, and returns the result.

func (Client) SubvolumeParentVolume

func (c Client) SubvolumeParentVolume(ctx context.Context, volConfig *storage.VolumeConfig) (*FileSystem, error)

SubvolumeParentVolume uses a volume config record to fetch a subvolume's parent volume.

func (Client) Subvolumes

func (c Client) Subvolumes(ctx context.Context, fileVolumePools []string) (*[]*Subvolume, error)

Subvolumes returns a list of all subvolumes.

func (Client) SubvolumesForVolume

func (c Client) SubvolumesForVolume(ctx context.Context, filesystem *FileSystem) (*[]*Subvolume, error)

SubvolumesForVolume returns a list of subvolume on a volume.

func (Client) ValidateFilePoolVolumes

func (c Client) ValidateFilePoolVolumes(
	ctx context.Context, filePoolVolumeNames []string,
) ([]*FileSystem, error)

ValidateFilePoolVolumes validates a filePoolVolume and its location

func (Client) Volume

func (c Client) Volume(ctx context.Context, volConfig *storage.VolumeConfig) (*FileSystem, error)

Volume uses a volume config record to fetch a volume by the most efficient means.

func (Client) VolumeByCreationToken

func (c Client) VolumeByCreationToken(ctx context.Context, creationToken string) (*FileSystem, error)

VolumeByCreationToken fetches a Filesystem by its immutable creation token. We can't query the SDK for volumes by creation token, so our only choice here is to get all volumes and return the one of interest. That is obviously very inefficient, so this method should be used only when absolutely necessary.

func (Client) VolumeByID

func (c Client) VolumeByID(ctx context.Context, id string) (*FileSystem, error)

VolumeByID returns a Filesystem based on its Azure-style ID.

func (Client) VolumeExists

func (c Client) VolumeExists(ctx context.Context, volConfig *storage.VolumeConfig) (bool, *FileSystem, error)

VolumeExists uses a volume config record to look for a Filesystem by the most efficient means.

func (Client) VolumeExistsByCreationToken

func (c Client) VolumeExistsByCreationToken(ctx context.Context, creationToken string) (bool, *FileSystem, error)

VolumeExistsByCreationToken checks whether a volume exists using its creation token as a key.

func (Client) VolumeExistsByID

func (c Client) VolumeExistsByID(ctx context.Context, id string) (bool, *FileSystem, error)

VolumeExistsByID checks whether a volume exists using its creation token as a key.

func (Client) Volumes

func (c Client) Volumes(ctx context.Context) (*[]*FileSystem, error)

Volumes returns a list of all volumes.

func (Client) WaitForSnapshotState

func (c Client) WaitForSnapshotState(
	ctx context.Context, snapshot *Snapshot, filesystem *FileSystem, desiredState string, abortStates []string,
	maxElapsedTime time.Duration,
) error

WaitForSnapshotState waits for a desired snapshot state and returns once that state is achieved.

func (Client) WaitForSubvolumeState

func (c Client) WaitForSubvolumeState(
	ctx context.Context, subvolume *Subvolume, desiredState string, abortStates []string,
	maxElapsedTime time.Duration,
) (string, error)

WaitForSubvolumeState watches for a desired subvolume state and returns when that state is achieved

func (Client) WaitForVolumeState

func (c Client) WaitForVolumeState(
	ctx context.Context, filesystem *FileSystem, desiredState string, abortStates []string,
	maxElapsedTime time.Duration, operation Operation,
) (string, error)

WaitForVolumeState watches for a desired volume state and returns when that state is achieved.

type ClientConfig

type ClientConfig struct {
	// Azure API authentication parameters
	azclient.AzureAuthConfig
	SubscriptionID    string `json:"subscriptionId"`
	Location          string `json:"location"`
	StorageDriverName string
	TenantID          string `json:"tenantId"`

	// Options
	DebugTraceFlags map[string]bool
	SDKTimeout      time.Duration // Timeout applied to all calls to the Azure SDK
	MaxCacheAge     time.Duration // The oldest data we should expect in the cached resources
}

ClientConfig holds configuration data for the API driver object.

type ExportPolicy

type ExportPolicy struct {
	Rules []ExportRule
}

ExportPolicy records details of a discovered Azure volume export policy.

type ExportRule

type ExportRule struct {
	AllowedClients      string
	Cifs                bool
	Nfsv3               bool
	Nfsv41              bool
	RuleIndex           int32
	UnixReadOnly        bool
	UnixReadWrite       bool
	Kerberos5ReadOnly   bool
	Kerberos5ReadWrite  bool
	Kerberos5IReadOnly  bool
	Kerberos5IReadWrite bool
	Kerberos5PReadOnly  bool
	Kerberos5PReadWrite bool
}

ExportRule records details of a discovered Azure volume export policy rule.

type FileSystem

type FileSystem struct {
	ID                string
	ResourceGroup     string
	NetAppAccount     string
	CapacityPool      string
	Name              string
	FullName          string
	Location          string
	Type              string
	ExportPolicy      ExportPolicy
	Labels            map[string]string
	FileSystemID      string
	ProvisioningState string
	CreationToken     string
	ProtocolTypes     []string
	QuotaInBytes      int64
	ServiceLevel      string
	SnapshotDirectory bool
	UsedBytes         int
	SubnetID          string
	UnixPermissions   string
	MountTargets      []MountTarget
	SubvolumesEnabled bool
	NetworkFeatures   string
	KerberosEnabled   bool
}

FileSystem records details of a discovered Azure Subnet.

type FilesystemCreateRequest

type FilesystemCreateRequest struct {
	ResourceGroup     string
	NetAppAccount     string
	CapacityPool      string
	Name              string
	SubnetID          string
	CreationToken     string
	ExportPolicy      ExportPolicy
	Labels            map[string]string
	ProtocolTypes     []string
	QuotaInBytes      int64
	SnapshotDirectory bool
	SnapshotID        string
	UnixPermissions   string
	NetworkFeatures   string
	KerberosEnabled   bool
}

FilesystemCreateRequest embodies all the details of a volume to be created.

type MountTarget

type MountTarget struct {
	MountTargetID string
	FileSystemID  string
	IPAddress     string
	ServerFqdn    string
}

MountTarget records details of a discovered Azure volume mount target.

type NetAppAccount

type NetAppAccount struct {
	ID            string
	ResourceGroup string
	Name          string
	FullName      string
	Location      string
	Type          string
	CapacityPools []*CapacityPool
}

NetAppAccount records details of a discovered ANF NetAppAccount.

type Operation

type Operation int64
const (
	Create Operation = iota
	Delete
	Update
	Restore
	Import
)

type PollerKey

type PollerKey struct {
	ID        string
	Operation Operation
}

type PollerResponse

type PollerResponse interface {
	Result(context.Context) error
}

type PollerResponseCache

type PollerResponseCache interface {
	Put(key *PollerKey, value PollerResponse) error
	Get(key PollerKey) (PollerResponse, bool)
	Delete(key PollerKey)
}

type PollerSVCreateResponse

type PollerSVCreateResponse struct {
	*runtime.Poller[netapp.SubvolumesClientCreateResponse]
}

func (*PollerSVCreateResponse) Result

type PollerSVDeleteResponse

type PollerSVDeleteResponse struct {
	*runtime.Poller[netapp.SubvolumesClientDeleteResponse]
}

func (*PollerSVDeleteResponse) Result

type PollerVolumeCreateResponse

type PollerVolumeCreateResponse struct {
	*runtime.Poller[netapp.VolumesClientCreateOrUpdateResponse]
}

func (*PollerVolumeCreateResponse) Result

type ResourceGroup

type ResourceGroup struct {
	Name            string
	NetAppAccounts  []*NetAppAccount
	VirtualNetworks []*VirtualNetwork
}

ResourceGroup records details of a discovered Azure ResourceGroup.

type Snapshot

type Snapshot struct {
	ID                string
	ResourceGroup     string
	NetAppAccount     string
	CapacityPool      string
	Volume            string
	Name              string
	FullName          string
	Location          string
	Type              string
	Created           time.Time
	SnapshotID        string
	ProvisioningState string
}

Snapshot records details of a discovered Azure snapshot.

type Subnet

type Subnet struct {
	ID             string
	ResourceGroup  string
	VirtualNetwork string
	Name           string
	FullName       string
	Location       string
	Type           string
}

Subnet records details of a discovered Azure Subnet.

type Subvolume

type Subvolume struct {
	ID                string
	ResourceGroup     string
	NetAppAccount     string
	CapacityPool      string
	Volume            string
	Name              string
	FullName          string
	Type              string
	ProvisioningState string
	Size              int64
	Created           time.Time
}

Subvolume records details of a discovered Azure Subvolume.

type SubvolumeCreateRequest

type SubvolumeCreateRequest struct {
	CreationToken string
	Volume        string
	Size          int64
	Parent        string
}

SubvolumeCreateRequest embodies all the details of a subvolume to be created.

type TerminalStateError

type TerminalStateError struct {
	Err error
}

TerminalStateError signals that the object is in a terminal state. This is used to stop waiting on an object to change state.

func TerminalState

func TerminalState(err error) *TerminalStateError

TerminalState wraps the given err in a *TerminalStateError.

func (*TerminalStateError) Error

func (e *TerminalStateError) Error() string

type VirtualNetwork

type VirtualNetwork struct {
	ID            string
	ResourceGroup string
	Name          string
	FullName      string
	Location      string
	Type          string
	Subnets       []*Subnet
}

VirtualNetwork records details of a discovered Azure Virtual Network.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL