Documentation ¶
Overview ¶
TODO: Switch to using the latest azure sdk and remove nolint. Related Ticket- https://github.com/kanisterio/kanister/issues/168
Index ¶
- Constants
- Variables
- func NewProvider(ctx context.Context, config map[string]string) (blockstorage.Provider, error)
- type AdStorage
- func (s *AdStorage) FromRegion(ctx context.Context, region string) ([]string, error)
- func (s *AdStorage) GetRegions(ctx context.Context) ([]string, error)
- func (s *AdStorage) SetTags(ctx context.Context, resource interface{}, tags map[string]string) error
- func (s *AdStorage) SnapshotCopy(ctx context.Context, from blockstorage.Snapshot, to blockstorage.Snapshot) (*blockstorage.Snapshot, error)
- func (s *AdStorage) SnapshotCopyWithArgs(ctx context.Context, from blockstorage.Snapshot, to blockstorage.Snapshot, ...) (*blockstorage.Snapshot, error)
- func (s *AdStorage) SnapshotCreate(ctx context.Context, volume blockstorage.Volume, tags map[string]string) (*blockstorage.Snapshot, error)
- func (s *AdStorage) SnapshotCreateWaitForCompletion(ctx context.Context, snap *blockstorage.Snapshot) error
- func (s *AdStorage) SnapshotDelete(ctx context.Context, snapshot *blockstorage.Snapshot) error
- func (s *AdStorage) SnapshotGet(ctx context.Context, id string) (*blockstorage.Snapshot, error)
- func (s *AdStorage) SnapshotParse(ctx context.Context, snapshot interface{}) (*blockstorage.Snapshot, error)
- func (s *AdStorage) SnapshotRestoreTargets(ctx context.Context, snapshot *blockstorage.Snapshot) (global bool, regionsAndZones map[string][]string, err error)
- func (s *AdStorage) SnapshotsList(ctx context.Context, tags map[string]string) ([]*blockstorage.Snapshot, error)
- func (s *AdStorage) Type() blockstorage.Type
- func (s *AdStorage) VolumeCreate(ctx context.Context, volume blockstorage.Volume) (*blockstorage.Volume, error)
- func (s *AdStorage) VolumeCreateFromSnapshot(ctx context.Context, snapshot blockstorage.Snapshot, tags map[string]string) (*blockstorage.Volume, error)
- func (s *AdStorage) VolumeDelete(ctx context.Context, volume *blockstorage.Volume) error
- func (s *AdStorage) VolumeGet(ctx context.Context, id string, zone string) (*blockstorage.Volume, error)
- func (s *AdStorage) VolumeParse(ctx context.Context, volume interface{}) (*blockstorage.Volume, error)
- func (s *AdStorage) VolumesList(ctx context.Context, tags map[string]string, zone string) ([]*blockstorage.Volume, error)
- type AzureAuthenticator
- type Client
- type ClientCredentialsConfig
- type ClientSecretAuthenticator
- type Environment
- type IPAddress
- type InstanceMetadata
- type LocationZoneMap
- type MsiAuthenticator
- type NetworkData
- type NetworkInterface
- type NetworkMetadata
- type Subnet
Constants ¶
const ActiveDirectory = "activeDirectory"
const (
// NotAvailable is used for endpoints and resource IDs that are not available for a given cloud.
NotAvailable = "N/A"
)
Variables ¶
var ( // PublicCloud is the default public Azure cloud environment //Ref: https://github.com/Azure/azure-sdk-for-go/blob/sdk/storage/azblob/v0.4.0/eng/common/TestResources/clouds/AzureCloud.json PublicCloud = Environment{ Name: "AzurePublicCloud", ResourceManagerEndpoint: "https://management.azure.com/", ActiveDirectoryEndpoint: "https://login.microsoftonline.com/", StorageEndpointSuffix: "core.windows.net", Configuration: cloud.AzurePublic, } // USGovernmentCloud is the cloud environment for the US Government //Ref: https://github.com/Azure/azure-sdk-for-go/blob/sdk/storage/azblob/v0.4.0/eng/common/TestResources/clouds/AzureUSGovernment.json USGovernmentCloud = Environment{ Name: "AzureUSGovernmentCloud", ResourceManagerEndpoint: "https://management.usgovcloudapi.net/", ActiveDirectoryEndpoint: "https://login.microsoftonline.us/", StorageEndpointSuffix: "core.usgovcloudapi.net", Configuration: cloud.AzureGovernment, } // ChinaCloud is the cloud environment operated in China //Ref: https://github.com/Azure/azure-sdk-for-go/blob/sdk/storage/azblob/v0.4.0/eng/common/TestResources/clouds/AzureChinaCloud.json ChinaCloud = Environment{ Name: "AzureChinaCloud", ResourceManagerEndpoint: "https://management.chinacloudapi.cn/", ActiveDirectoryEndpoint: "https://login.chinacloudapi.cn/", StorageEndpointSuffix: "core.chinacloudapi.cn", Configuration: cloud.AzureChina, } // GermanCloud is the cloud environment operated in Germany has been deprecated // Ref: https://learn.microsoft.com/en-us/previous-versions/azure/germany/germany-welcome GermanCloud = Environment{ Name: "AzureGermanCloud", ResourceManagerEndpoint: NotAvailable, ActiveDirectoryEndpoint: NotAvailable, StorageEndpointSuffix: NotAvailable, Configuration: cloud.Configuration{}, } )
Functions ¶
func NewProvider ¶
NewProvider returns a provider for the Azure blockstorage type
Types ¶
type AdStorage ¶
type AdStorage struct {
// contains filtered or unexported fields
}
AdStorage describes the azure storage client
func (*AdStorage) FromRegion ¶
func (*AdStorage) GetRegions ¶
func (*AdStorage) SnapshotCopy ¶
func (s *AdStorage) SnapshotCopy(ctx context.Context, from blockstorage.Snapshot, to blockstorage.Snapshot) (*blockstorage.Snapshot, error)
func (*AdStorage) SnapshotCopyWithArgs ¶
func (s *AdStorage) SnapshotCopyWithArgs(ctx context.Context, from blockstorage.Snapshot, to blockstorage.Snapshot, args map[string]string) (*blockstorage.Snapshot, error)
SnapshotCopyWithArgs func: args map should contain non-empty StorageAccountName(AZURE_MIGRATE_STORAGE_ACCOUNT_NAME) and StorageKey(AZURE_MIGRATE_STORAGE_ACCOUNT_KEY) A destination ResourceGroup (AZURE_MIGRATE_RESOURCE_GROUP) can be provided. The created snapshot will belong to this.
func (*AdStorage) SnapshotCreate ¶
func (s *AdStorage) SnapshotCreate(ctx context.Context, volume blockstorage.Volume, tags map[string]string) (*blockstorage.Snapshot, error)
func (*AdStorage) SnapshotCreateWaitForCompletion ¶
func (*AdStorage) SnapshotDelete ¶
func (*AdStorage) SnapshotGet ¶
func (*AdStorage) SnapshotParse ¶
func (*AdStorage) SnapshotRestoreTargets ¶
func (*AdStorage) SnapshotsList ¶
func (*AdStorage) Type ¶
func (s *AdStorage) Type() blockstorage.Type
func (*AdStorage) VolumeCreate ¶
func (s *AdStorage) VolumeCreate(ctx context.Context, volume blockstorage.Volume) (*blockstorage.Volume, error)
func (*AdStorage) VolumeCreateFromSnapshot ¶
func (s *AdStorage) VolumeCreateFromSnapshot(ctx context.Context, snapshot blockstorage.Snapshot, tags map[string]string) (*blockstorage.Volume, error)
func (*AdStorage) VolumeDelete ¶
func (*AdStorage) VolumeParse ¶
type AzureAuthenticator ¶
type AzureAuthenticator interface { Authenticate(creds map[string]string) error GetAuthorizer() azcore.TokenCredential }
Public interface to authenticate with different Azure credentials type
func NewAzureAuthenticator ¶
func NewAzureAuthenticator(config map[string]string) (AzureAuthenticator, error)
type Client ¶
type Client struct { Cred azcore.TokenCredential SubscriptionID string ResourceGroup string BaseURI string DisksClient *armcompute.DisksClient SnapshotsClient *armcompute.SnapshotsClient SKUsClient *armcompute.ResourceSKUsClient SubscriptionsClient *armsubscriptions.Client }
Client is a wrapper
type ClientCredentialsConfig ¶
type ClientCredentialsConfig struct { ClientID string ClientSecret string TenantID string AuxTenants []string AADEndpoint string Resource string }
func NewClientCredentialsConfig ¶
func NewClientCredentialsConfig(clientID string, clientSecret string, tenantID string) ClientCredentialsConfig
Defaults to Public Cloud and Resource Manager Endpoint.
type ClientSecretAuthenticator ¶
type ClientSecretAuthenticator struct {
azcore.TokenCredential
}
authenticate with client secret creds
func (*ClientSecretAuthenticator) Authenticate ¶
func (c *ClientSecretAuthenticator) Authenticate(creds map[string]string) error
func (*ClientSecretAuthenticator) GetAuthorizer ¶
func (c *ClientSecretAuthenticator) GetAuthorizer() azcore.TokenCredential
type Environment ¶
type Environment struct { Name string `json:"name"` ResourceManagerEndpoint string `json:"resourceManagerEndpoint"` ActiveDirectoryEndpoint string `json:"activeDirectoryEndpoint"` StorageEndpointSuffix string `json:"storageEndpointSuffix"` Configuration cloud.Configuration }
Environment represents a set of endpoints for each of Azure's Clouds.
func EnvironmentFromName ¶
func EnvironmentFromName(name string) (Environment, error)
EnvironmentFromName returns an Environment based on the common name specified.
type IPAddress ¶
type IPAddress struct { PrivateIP string `json:"privateIPAddress"` PublicIP string `json:"publicIPAddress"` }
IPAddress represents IP address information.
type InstanceMetadata ¶
type InstanceMetadata struct {
// contains filtered or unexported fields
}
InstanceMetadata knows how to query the Azure instance metadata server.
func NewInstanceMetadata ¶
func NewInstanceMetadata() *InstanceMetadata
NewInstanceMetadata creates an instance of the InstanceMetadata accessor object.
func (*InstanceMetadata) Object ¶
func (i *InstanceMetadata) Object(path string, obj interface{}) error
Object queries the metadata server and populates the passed in object
type LocationZoneMap ¶
type LocationZoneMap map[string]struct{}
type MsiAuthenticator ¶
type MsiAuthenticator struct {
azcore.TokenCredential
}
authenticate with MSI creds
func (*MsiAuthenticator) Authenticate ¶
func (m *MsiAuthenticator) Authenticate(config map[string]string) error
func (*MsiAuthenticator) GetAuthorizer ¶
func (m *MsiAuthenticator) GetAuthorizer() azcore.TokenCredential
type NetworkData ¶
type NetworkData struct { IPAddress []IPAddress `json:"ipAddress"` Subnet []Subnet `json:"subnet"` }
NetworkData contains IP information for a network.
type NetworkInterface ¶
type NetworkInterface struct { IPV4 NetworkData `json:"ipv4"` IPV6 NetworkData `json:"ipv6"` MAC string `json:"macAddress"` }
NetworkInterface represents an instances network interface.
type NetworkMetadata ¶
type NetworkMetadata struct {
Interface []NetworkInterface `json:"interface"`
}
NetworkMetadata contains metadata about an instance's network