Documentation ¶
Index ¶
- type Azure
- type AzureConnection
- func (az *AzureConnection) ClusterHasRoleAssignment(resourceGroupName, clusterName, roleDefName string) (bool, error)
- func (az *AzureConnection) CreateStorageAccount(accountName, accountGroupName string, tags map[string]*string, httpsOnly bool, ...) (storage.Account, error)
- func (az *AzureConnection) DeleteStorageAccount(resourceGroupName, accountName string) error
- func (az *AzureConnection) GetDisk(resourceGroupName string, diskName string) (compute.Disk, error)
- func (az *AzureConnection) GetJSONRepresentation(resourceGroupName string, diskName string) (dskJSON []byte, err error)
- func (az *AzureConnection) GetManagedClusterAdminCredentials(resourceGroupName, clusterName string) (string, error)
- func (az *AzureConnection) GetManagedClusterJSON(resourceGroupName, clusterName string) ([]byte, error)
- func (az *AzureConnection) GetResourceGroupByName(name string) (resources.Group, error)
- func (az *AzureConnection) IsCloudAvailable() error
- func (az *AzureConnection) ParseDiskDetails(diskURI string) (string, string)
- type AzureCredentials
- type AzureDisk
- func (dsk *AzureDisk) GetDisk(resourceGroup string, diskName string) (d compute.Disk, err error)
- func (dsk *AzureDisk) GetJSONRepresentation(resourceGroupName string, diskName string) (dskJSON []byte, err error)
- func (dsk *AzureDisk) ParseDiskDetails(diskURI string) (resourceGroupName, diskName string)
- type AzureManagedCluster
- func (amc *AzureManagedCluster) ClusterHasRoleAssignment(resourceGroupName, clusterName, roleDefName string) (present bool, err error)
- func (amc *AzureManagedCluster) GetClusterAdminCredentials(resourceGroupName, clusterName string) (kubeconfigBase64 string, err error)
- func (amc *AzureManagedCluster) GetJSONRepresentation(resourceGroupName string, clusterName string) (aksJSON []byte, err error)
- type AzureResourceGroup
- type AzureStorageAccount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Azure ¶
type Azure interface { IsCloudAvailable() error GetResourceGroupByName(name string) (resources.Group, error) // Storage Account Functions CreateStorageAccount(accountName, accountGroupName string, tags map[string]*string, httpsOnly bool, networkRuleSet *storage.NetworkRuleSet) (storage.Account, error) DeleteStorageAccount(resourceGroupName, accountName string) error //AKS Functions GetManagedClusterJSON(resourceGroupName, clusterName string) ([]byte, error) GetManagedClusterAdminCredentials(resourceGroupName, clusterName string) (string, error) ClusterHasRoleAssignment(resourceGroupName, clusterName, roleDefName string) (bool, error) //Azure Disk functions GetDisk(resourceGroupName string, diskName string) (d compute.Disk, err error) ParseDiskDetails(diskURI string) (resourceGroupName, diskName string) GetJSONRepresentation(resourceGroupName string, diskName string) (dskJSON []byte, err error) }
Azure interface defining all azure methods
type AzureConnection ¶
type AzureConnection struct { ResourceGroup *AzureResourceGroup // Client obj to interact with Azure Resource Groups StorageAccount *AzureStorageAccount // Client obj to interact with Azure Storage Accounts ManagedCluster *AzureManagedCluster // Client obj to interact with Azure Kubernetes Service Disk *AzureDisk // Client obj to interact with Azure Disks // contains filtered or unexported fields }
AzureConnection simplifies the connection with cloud provider
func NewAzureConnection ¶
func NewAzureConnection(c context.Context, subscriptionID, tenantID, clientID, clientSecret string) *AzureConnection
NewAzureConnection provides a singleton instance of AzureConnection. Initializes all internal clients to interact with Azure.
func (*AzureConnection) ClusterHasRoleAssignment ¶
func (az *AzureConnection) ClusterHasRoleAssignment(resourceGroupName, clusterName, roleDefName string) (bool, error)
ClusterHasRoleAssignment looks through the Azure role assignments on the cluster and returns true if it find the role assigned. Note that the roleDefName is the UUID of the role not the friendly name of the role.
func (*AzureConnection) CreateStorageAccount ¶
func (az *AzureConnection) CreateStorageAccount(accountName, accountGroupName string, tags map[string]*string, httpsOnly bool, networkRuleSet *storage.NetworkRuleSet) (storage.Account, error)
CreateStorageAccount creates a storage account
func (*AzureConnection) DeleteStorageAccount ¶
func (az *AzureConnection) DeleteStorageAccount(resourceGroupName, accountName string) error
DeleteStorageAccount deletes a storage account
func (*AzureConnection) GetJSONRepresentation ¶
func (az *AzureConnection) GetJSONRepresentation(resourceGroupName string, diskName string) (dskJSON []byte, err error)
GetJSONRepresentation returns the JSON representation of an AKS cluster, similar to az aks show. NOTE that the output from this function has differences to the az cli that needs to be accomodated if you are using the JSON created by this function.
func (*AzureConnection) GetManagedClusterAdminCredentials ¶
func (az *AzureConnection) GetManagedClusterAdminCredentials(resourceGroupName, clusterName string) (string, error)
GetManagedClusterAdminCredentials returns a base64 encoded kubeconfig file for the cluster admin (equivalent to az get-credentials --admin)
func (*AzureConnection) GetManagedClusterJSON ¶
func (az *AzureConnection) GetManagedClusterJSON(resourceGroupName, clusterName string) ([]byte, error)
GetManagedClusterJSON returns the JSON representation of an AKS cluster, similar to az aks show. NOTE that the output from this function has differences to the az cli that needs to be accomodated if you are using the JSON created by this function.
func (*AzureConnection) GetResourceGroupByName ¶
func (az *AzureConnection) GetResourceGroupByName(name string) (resources.Group, error)
GetResourceGroupByName returns an existing Resource Group by name
func (*AzureConnection) IsCloudAvailable ¶
func (az *AzureConnection) IsCloudAvailable() error
IsCloudAvailable verifies that the connection instantiation did not report a failure
func (*AzureConnection) ParseDiskDetails ¶
func (az *AzureConnection) ParseDiskDetails(diskURI string) (string, string)
ParseDiskDetails parses the resource group name and disk name from an Azure Disk URI
type AzureCredentials ¶
type AzureCredentials struct {
SubscriptionID, ClientID, TenantID, ClientSecret string
Authorizer autorest.Authorizer
}
AzureCredentials ...
type AzureDisk ¶
type AzureDisk struct {
// contains filtered or unexported fields
}
AzureDisk contains the state of the Azure Disk context
func NewDisk ¶
func NewDisk(ctx context.Context, creds AzureCredentials) (dsk *AzureDisk, err error)
NewDisk validates the context and credentials, and retrieves the corresponding Disks Client
func (*AzureDisk) GetJSONRepresentation ¶
func (dsk *AzureDisk) GetJSONRepresentation(resourceGroupName string, diskName string) (dskJSON []byte, err error)
GetJSONRepresentation returns the JSON representation of an AKS cluster, similar to az aks show. NOTE that the output from this function has differences to the az cli that needs to be accomodated if you are using the JSON created by this function.
func (*AzureDisk) ParseDiskDetails ¶
ParseDiskDetails returns the resource group name and disk name of the Managed Disk
type AzureManagedCluster ¶
type AzureManagedCluster struct {
// contains filtered or unexported fields
}
AzureManagedCluster holds the state of the Azure context
func NewContainerService ¶
func NewContainerService(c context.Context, creds AzureCredentials) (cs *AzureManagedCluster, err error)
NewContainerService provides a new instance of AzureContainerService
func (*AzureManagedCluster) ClusterHasRoleAssignment ¶
func (amc *AzureManagedCluster) ClusterHasRoleAssignment(resourceGroupName, clusterName, roleDefName string) (present bool, err error)
ClusterHasRoleAssignment looks through the Azure role assignments on the cluster and returns true if it find the role assigned. Note that the roleDefName is the UUID of the role not the friendly name of the role.
func (*AzureManagedCluster) GetClusterAdminCredentials ¶
func (amc *AzureManagedCluster) GetClusterAdminCredentials(resourceGroupName, clusterName string) (kubeconfigBase64 string, err error)
GetClusterAdminCredentials returns a base64 encoded kubeconfig file for the cluster admin (equivalent to az get-credentials --admin)
func (*AzureManagedCluster) GetJSONRepresentation ¶
func (amc *AzureManagedCluster) GetJSONRepresentation(resourceGroupName string, clusterName string) (aksJSON []byte, err error)
GetJSONRepresentation returns the JSON representation of an AKS cluster, similar to az aks show. NOTE that the output from this function has differences to the az cli that needs to be accomodated if you are using the JSON created by this function.
type AzureResourceGroup ¶
type AzureResourceGroup struct {
// contains filtered or unexported fields
}
AzureResourceGroup ...
func NewResourceGroup ¶
func NewResourceGroup(c context.Context, creds AzureCredentials) (rg *AzureResourceGroup, err error)
NewResourceGroup provides a new instance of AzureResourceGroup
type AzureStorageAccount ¶
type AzureStorageAccount struct {
// contains filtered or unexported fields
}
AzureStorageAccount ...
func NewStorageAccount ¶
func NewStorageAccount(c context.Context, creds AzureCredentials) (sa *AzureStorageAccount, err error)
NewStorageAccount provides a new instance of AzureStorageAccount
func (*AzureStorageAccount) Create ¶
func (sa *AzureStorageAccount) Create(accountName, accountGroupName string, tags map[string]*string, httpsOnly bool, networkRuleSet *storage.NetworkRuleSet) (storage.Account, error)
Create starts creation of a new Storage Account and waits for the account to be created.
func (*AzureStorageAccount) Delete ¶
func (sa *AzureStorageAccount) Delete(resourceGroupName, accountName string) error
Delete deletes a storage account given the resource group and account name