sdk

package
v19.10.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

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

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

Index

Constants

View Source
const (
	PServiceLevel = "serviceLevel"
	PLocation     = "location"
	PSubnet       = "subnet"

	DoNotUseSPoolName = "Couldn't do a reverse lookup for storage pool name"
)
View Source
const (
	StateCreating  = "InProgress"
	StateAvailable = "Succeeded"
	StateDeleting  = "Deleting"
	StateDeleted   = "NoSuchState"
	StateError     = "Failed"

	ProtocolTypeNFSv3 = "NFSv3"
	ProtocolTypeNFSv4 = "NFSv4"
	ProtocolTypeCIFS  = "CIFS"

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

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureCapacityPoolCookie

type AzureCapacityPoolCookie struct {
	ResourceGroup    *string
	NetAppAccount    *string
	CapacityPoolName *string
	StoragePoolName  *string
}

AzureCapacityPoolCookie is a convenience bundle for mapping resources to the SDK API

type AzureClient

AzureClient holds operational Azure SDK objects

func NewSDKClient

func NewSDKClient(config *ClientConfig) (c *AzureClient)

NewSDKClient allocates the various clients for the SDK

func (*AzureClient) Authenticate

func (c *AzureClient) Authenticate() (err error)

Authenticate plumbs the authorization through to subclients

type AzureResources

type AzureResources struct {
	ResourceGroups []ResourceGroup
	StoragePoolMap map[string]*storage.Pool
	// 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 {
	Location          string      `json:"location,omitempty"`
	ID                string      `json:"id,omitempty"`
	Name              string      `json:"name,omitempty"`
	Fullname          string      `json:"fullname,omitempty"`
	ResourceGroup     string      `json:"resourceGroup,omitempty"`
	NetAppAccount     string      `json:"netAppAccount,omitempty"`
	Type              string      `json:"type,omitempty"`
	Tags              interface{} `json:"tags,omitempty"`
	PoolID            string      `json:"poolId,omitempty"`
	Size              int64       `json:"size,omitempty"`
	ServiceLevel      string      `json:"serviceLevel,omitempty"`
	ProvisioningState string      `json:"provisioningState,omitempty"`
}

type Client

type Client struct {
	SDKClient *AzureClient
	// contains filtered or unexported fields
}

Client encapsulates connection details

func NewDriver

func NewDriver(config ClientConfig) *Client

NewDriver is a factory method for creating a new instance.

func (*Client) CreateSnapshot

func (d *Client) CreateSnapshot(request *SnapshotCreateRequest) (*Snapshot, error)

CreateSnapshot creates a new snapshot

func (*Client) CreateVolume

func (d *Client) CreateVolume(request *FilesystemCreateRequest) (*FileSystem, error)

CreateVolume creates a new volume

func (*Client) DeleteSnapshot

func (d *Client) DeleteSnapshot(filesystem *FileSystem, snapshot *Snapshot) error

DeleteSnapshot deletes a snapshot

func (*Client) DeleteVolume

func (d *Client) DeleteVolume(filesystem *FileSystem) error

DeleteVolume deletes a volume

func (*Client) GetCookieByCapacityPoolName

func (d *Client) GetCookieByCapacityPoolName(poolname string) (*AzureCapacityPoolCookie, error)

GetCookieByCapacityPoolName searches for a matching capacity pool name and returns an access cookie

func (*Client) GetCookieByStoragePoolName

func (d *Client) GetCookieByStoragePoolName(spoolname string) (*AzureCapacityPoolCookie, error)

GetCookieByStoragePoolName searches for a cookie with a matching storage pool name

func (*Client) GetMountTargetsForVolume

func (d *Client) GetMountTargetsForVolume(filesystem *FileSystem) (*[]MountTarget, error)

GetMountTargetsForVolume returns mount target information for a volume

func (*Client) GetSnapshotByID

func (d *Client) GetSnapshotByID(snapshotID string, filesystem *FileSystem) (*Snapshot, error)

GetSnapshotByID fetches a specific snapshot on a volume by its ID

func (*Client) GetSnapshotForVolume

func (d *Client) GetSnapshotForVolume(filesystem *FileSystem, snapshotName string) (*Snapshot, error)

GetSnapshotForVolume fetches a specific snaphot on a volume by its name

func (*Client) GetSnapshotsForVolume

func (d *Client) GetSnapshotsForVolume(filesystem *FileSystem) (*[]Snapshot, error)

GetSnapshotsForVolume returns a list of snapshots on a volume

func (*Client) GetVolumeByCreationToken

func (d *Client) GetVolumeByCreationToken(creationToken string) (*FileSystem, error)

GetVolumeByCreationToken fetches a Filesystem by its immutable creation token

func (*Client) GetVolumeByID

func (d *Client) GetVolumeByID(fileSystemID string) (*FileSystem, error)

GetVolumeByID returns a Filesystem based on its ID

func (*Client) GetVolumeByName

func (d *Client) GetVolumeByName(name string) (*FileSystem, error)

GetVolumeByName fetches a Filesystem based on its readable name

func (*Client) GetVolumes

func (d *Client) GetVolumes() (*[]FileSystem, error)

GetVolumes returns a list of ALL volumes

func (*Client) Init

func (d *Client) Init(pools map[string]*storage.Pool) (err error)

Init runs startup logic after allocating the driver resources

func (*Client) RegisterStoragePool

func (d *Client) RegisterStoragePool(spool storage.Pool)

RegisterStoragePool makes a note of pools defined by the driver for later mapping

func (*Client) RelabelVolume

func (d *Client) RelabelVolume(filesystem *FileSystem, labels []string) (*FileSystem, error)

RelabelVolume updates the 'trident' telemetry label on a volume

func (*Client) RenameRelabelVolume

func (d *Client) RenameRelabelVolume(filesystem *FileSystem, newName string, labels []string) (*FileSystem, error)

RenameRelabelVolume is probably not supported on Azure

func (*Client) RenameVolume

func (d *Client) RenameVolume(filesystem *FileSystem, newName string) (*FileSystem, error)

RenameVolume is probably not supported on Azure?

func (*Client) ResizeVolume

func (d *Client) ResizeVolume(filesystem *FileSystem, newSizeBytes int64) (*FileSystem, error)

ResizeVolume sends a VolumePatch to update the Quota

func (*Client) RestoreSnapshot

func (d *Client) RestoreSnapshot(filesystem *FileSystem, snapshot *Snapshot) error

RestoreSnapshot does not seem to have an API on Azure, unless it's the mysterious 'Do'

func (*Client) Terminate

func (d *Client) Terminate()

Terminate signals any running threads to exit at their earliest convenience

func (*Client) VolumeExistsByCreationToken

func (d *Client) VolumeExistsByCreationToken(creationToken string) (bool, *FileSystem, error)

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

func (*Client) WaitForSnapshotState

func (d *Client) WaitForSnapshotState(snapshot *Snapshot, filesystem *FileSystem, desiredState string, abortStates []string) error

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

func (*Client) WaitForVolumeState

func (d *Client) WaitForVolumeState(filesystem *FileSystem, desiredState string, abortStates []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
	SubscriptionID string
	TenantID       string
	ClientID       string
	ClientSecret   string

	// Options
	DebugTraceFlags map[string]bool
}

ClientConfig holds configuration data for the API driver object.

type ExportPolicy

type ExportPolicy struct {
	Rules []ExportRule `json:"rules"`
}

type ExportRule

type ExportRule struct {
	AllowedClients string `json:"allowedClients"`
	Cifs           bool   `json:"cifs"`
	Nfsv3          bool   `json:"nfsv3"`
	Nfsv4          bool   `json:"nfsv4"`
	RuleIndex      int    `json:"ruleIndex"`
	UnixReadOnly   bool   `json:"unixReadOnly"`
	UnixReadWrite  bool   `json:"unixReadWrite"`
}

type FileSystem

type FileSystem struct {
	Created           time.Time    `json:"created,omitempty"`
	ExportPolicy      ExportPolicy `json:"exportPolicy,omitempty"`
	Labels            []string     `json:"labels,omitempty"`
	FileSystemID      string       `json:"fileSystemId,omitempty"`
	ID                string       `json:"id,omitempty"`
	ProvisioningState string       `json:"provisioningState,omitempty"`
	Name              string       `json:"name,omitempty"`
	CapacityPoolName  string       `json:"capacityPoolName,omitempty"`
	OwnerID           string       `json:"ownerId,omitempty"`
	Location          string       `json:"location,omitempty"`
	CreationToken     string       `json:"creationToken,omitempty"`
	ProtocolTypes     []string     `json:"protocolTypes,omitempty"`
	QuotaInBytes      int64        `json:"quotaInBytes,omitempty"`
	ServiceLevel      string       `json:"serviceLevel,omitempty"`
	Timezone          string       `json:"timezone,omitempty"`
	UsedBytes         int          `json:"usedBytes,omitempty"`
	Subnet            string       `json:"subnet,omitempty"`
}

type FilesystemCreateRequest

type FilesystemCreateRequest struct {
	Name           string       `json:"name"`
	Location       string       `json:"location"`
	CapacityPool   string       `json:"capacityPool"`
	VirtualNetwork string       `json:"virtualNetwork"`
	Subnet         string       `json:"subnet"`
	CreationToken  string       `json:"creationToken"`
	ExportPolicy   ExportPolicy `json:"exportPolicy,omitempty"`
	Labels         []string     `json:"labels,omitempty"`
	PoolID         string       `json:"poolId,omitempty"`
	ProtocolTypes  []string     `json:"protocolTypes,omitempty"`
	QuotaInBytes   int64        `json:"quotaInBytes"`
	ServiceLevel   string       `json:"serviceLevel"`
	Timezone       string       `json:"timezone,omitempty"`
	SnapshotID     string       `json:"snapshotId,omitempty"`
}

type FilesystemRenameRelabelRequest

type FilesystemRenameRelabelRequest struct {
	Name          string   `json:"name"`
	Location      string   `json:"location"`
	CreationToken string   `json:"creationToken"`
	ServiceLevel  string   `json:"serviceLevel"`
	Labels        []string `json:"labels"`
}

type FilesystemRenameRequest

type FilesystemRenameRequest struct {
	Name          string `json:"name"`
	Location      string `json:"location"`
	CreationToken string `json:"creationToken"`
	ServiceLevel  string `json:"serviceLevel"`
}

type FilesystemResizeRequest

type FilesystemResizeRequest struct {
	Location      string `json:"location"`
	CreationToken string `json:"creationToken"`
	QuotaInBytes  int64  `json:"quotaInBytes"`
	ServiceLevel  string `json:"serviceLevel"`
}

type MountTarget

type MountTarget struct {
	Created           time.Time `json:"created"`
	FileSystemID      string    `json:"fileSystemId"`
	ProvisioningState string    `json:"provisioningState"`
	OwnerID           string    `json:"ownerId"`
	Location          string    `json:"location"`
	EndIP             string    `json:"endIP"`
	Gateway           string    `json:"gateway"`
	IPAddress         string    `json:"ipAddress"`
	MountTargetID     string    `json:"mountTargetId"`
	Netmask           string    `json:"netmask"`
	StartIP           string    `json:"startIP"`
	Subnet            string    `json:"subnet"`
}

type NetAppAccount

type NetAppAccount struct {
	Name          string
	Location      string
	CapacityPools []CapacityPool
}

NetAppAccount records details of a discovered ANF NetAppAccount

type ResourceGroup

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

ResourceGroup records details of a discovered Azure ResourceGroup

type Snapshot

type Snapshot struct {
	Created           date.Time `json:"created"`
	FileSystemID      string    `json:"fileSystemId"`
	ProvisioningState string    `json:"provisioningState"`
	Name              string    `json:"name"`
	OwnerID           string    `json:"ownerId"`
	Location          string    `json:"location"`
	SnapshotID        string    `json:"snapshotId"`
	UsedBytes         int       `json:"usedBytes"`
}

type SnapshotCreateRequest

type SnapshotCreateRequest struct {
	FileSystemID string      `json:"fileSystemId"`
	Volume       *FileSystem `json:"fileSystem"`
	Name         string      `json:"name"`
	Location     string      `json:"location"`
}

type Subnet

type Subnet struct {
	Name           string
	VirtualNetwork *VirtualNetwork // backpointer to parent
}

Subnet records details of a discovered Azure Subnet

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 {
	Name          string
	Location      string
	Subnets       []Subnet
	ResourceGroup string
}

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