azure

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AgentPoolProfileName is a format string for the name of the automatically
	// created cluster agent pool profile
	AgentPoolProfileName = "agentpool"
)
View Source
const (
	// UserAgent is the user agent extension that identifies the Crossplane Azure client
	UserAgent = "crossplane-azure-client"
)

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a value indicating whether the given error represents that the resource was not found.

func SQLServerConditionType added in v0.2.0

func SQLServerConditionType(state string) corev1alpha1.ConditionType

SQLServerConditionType converts the given MySQL Server state string into a corresponding condition type

func SQLServerSkuName added in v0.2.0

func SQLServerSkuName(pricingTier azuredbv1alpha1.PricingTierSpec) (string, error)

SQLServerSkuName returns the name of the MySQL Server SKU, which is tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.

func SQLServerStatusMessage added in v0.2.0

func SQLServerStatusMessage(instanceName string, state string) string

SQLServerStatusMessage returns a status message based on the given server state

func SanitizeClusterName

func SanitizeClusterName(name string) string

SanitizeClusterName sanitizes the given AKS cluster name

func ToBoolPtr added in v0.2.0

func ToBoolPtr(b bool, o ...FieldOption) *bool

ToBoolPtr converts the supplied bool for use with the Azure Go SDK.

func ToGeoRedundantBackup

func ToGeoRedundantBackup(geoRedundantBackup bool) mysql.GeoRedundantBackup

ToGeoRedundantBackup converts the given bool its corresponding GeoRedundantBackup value

func ToInt added in v0.2.0

func ToInt(i *int32) int

ToInt converts the supplied pointer to int32 to an int, returning zero if the pointer is nil,

func ToInt32Ptr added in v0.2.0

func ToInt32Ptr(i int, o ...FieldOption) *int32

ToInt32Ptr converts the supplied int for use with the Azure Go SDK.

func ToSslEnforcement

func ToSslEnforcement(sslEnforced bool) mysql.SslEnforcementEnum

ToSslEnforcement converts the given bool its corresponding SslEnforcementEnum value

func ToString added in v0.2.0

func ToString(s *string) string

ToString converts the supplied pointer to string to a string, returning the empty string if the pointer is nil.

func ToStringPtr added in v0.2.0

func ToStringPtr(s string, o ...FieldOption) *string

ToStringPtr converts the supplied string for use with the Azure Go SDK.

func ToStringPtrMap added in v0.2.0

func ToStringPtrMap(m map[string]string) map[string]*string

ToStringPtrMap converts the supplied map for use with the Azure Go SDK.

func ValidateClient

func ValidateClient(client *Client) error

ValidateClient verifies if the given client is valid by testing if it can make an Azure service API call TODO: is there a better way to validate the Azure client?

Types

type AKSClusterAPI

type AKSClusterAPI interface {
	Get(ctx context.Context, instance computev1alpha1.AKSCluster) (containerservice.ManagedCluster, error)
	CreateOrUpdateBegin(ctx context.Context, instance computev1alpha1.AKSCluster, clusterName, appID, spSecret string) ([]byte, error)
	CreateOrUpdateEnd(op []byte) (bool, error)
	Delete(ctx context.Context, instance computev1alpha1.AKSCluster) (containerservice.ManagedClustersDeleteFuture, error)
	ListClusterAdminCredentials(ctx context.Context, instance computev1alpha1.AKSCluster) (containerservice.CredentialResults, error)
}

AKSClusterAPI represents the API interface for a AKS Cluster client

type AKSClusterClient

type AKSClusterClient struct {
	containerservice.ManagedClustersClient
}

AKSClusterClient is the concreate implementation of the AKSClusterAPI interface that calls Azure API.

func NewAKSClusterClient

func NewAKSClusterClient(provider *v1alpha1.Provider, clientset kubernetes.Interface) (*AKSClusterClient, error)

NewAKSClusterClient creates and initializes a AKSClusterClient instance.

func (*AKSClusterClient) CreateOrUpdateBegin

func (c *AKSClusterClient) CreateOrUpdateBegin(ctx context.Context, instance computev1alpha1.AKSCluster, clusterName, appID, spSecret string) ([]byte, error)

CreateOrUpdateBegin begins the create/update operation for a AKS Cluster with the given properties

func (*AKSClusterClient) CreateOrUpdateEnd

func (c *AKSClusterClient) CreateOrUpdateEnd(op []byte) (done bool, err error)

CreateOrUpdateEnd checks to see if the given create/update operation is completed and if any error has occurred.

func (*AKSClusterClient) Delete

Delete begins the deletion operator for the given AKS cluster instance

func (*AKSClusterClient) Get

Get returns the AKS cluster details for the given instance

func (*AKSClusterClient) ListClusterAdminCredentials

func (c *AKSClusterClient) ListClusterAdminCredentials(ctx context.Context, instance computev1alpha1.AKSCluster) (containerservice.CredentialResults, error)

ListClusterAdminCredentials will return the admin credentials used to connect to the given AKS cluster

type AKSSetupAPIFactory

type AKSSetupAPIFactory interface {
	CreateSetupClient(*v1alpha1.Provider, kubernetes.Interface) (*AKSSetupClient, error)
}

AKSSetupAPIFactory is an interface that can create instances of the AKSSetupClient

type AKSSetupClient

type AKSSetupClient struct {
	AKSClusterAPI
	ApplicationAPI
	ServicePrincipalAPI
}

AKSSetupClient is a type that implements all of the AKS setup interface

type AKSSetupClientFactory

type AKSSetupClientFactory struct {
}

AKSSetupClientFactory implements the AKSSetupAPIFactory interface by returning real clients that talk to Azure APIs

func (*AKSSetupClientFactory) CreateSetupClient

func (f *AKSSetupClientFactory) CreateSetupClient(provider *v1alpha1.Provider, clientset kubernetes.Interface) (*AKSSetupClient, error)

CreateSetupClient creates and returns an AKS setup client that is ready to talk to Azure APIs

type ApplicationAPI

type ApplicationAPI interface {
	CreateApplication(ctx context.Context, appParams ApplicationParameters) (*graphrbac.Application, error)
	DeleteApplication(ctx context.Context, appObjectID string) error
}

ApplicationAPI represents the API interface for an Azure Application client

type ApplicationClient

type ApplicationClient struct {
	graphrbac.ApplicationsClient
}

ApplicationClient is the concreate implementation of the ApplicationAPI interface that calls Azure API.

func NewApplicationClient

func NewApplicationClient(provider *v1alpha1.Provider, clientset kubernetes.Interface) (*ApplicationClient, error)

NewApplicationClient creates and initializes a ApplicationClient instance.

func (*ApplicationClient) CreateApplication

func (c *ApplicationClient) CreateApplication(ctx context.Context, appParams ApplicationParameters) (*graphrbac.Application, error)

CreateApplication creates a new AD application with the given parameters

func (*ApplicationClient) DeleteApplication

func (c *ApplicationClient) DeleteApplication(ctx context.Context, appObjectID string) error

DeleteApplication will delete the given AD application

type ApplicationParameters

type ApplicationParameters struct {
	Name          string
	DNSNamePrefix string
	Location      string
	ObjectID      string
	ClientSecret  string
}

ApplicationParameters are the parameters used to create an AD application

type Client

type Client struct {
	autorest.Authorizer
	SubscriptionID string
	// contains filtered or unexported fields
}

Client struct that represents the information needed to connect to the Azure services as a client

func NewClient

func NewClient(provider *v1alpha1.Provider, clientset kubernetes.Interface) (*Client, error)

NewClient will look up the Azure credential information from the given provider and return a client that can be used to connect to Azure services.

type Credentials added in v0.2.0

type Credentials struct {
	ClientID                       string `json:"clientId"`
	ClientSecret                   string `json:"clientSecret"`
	TenantID                       string `json:"tenantId"`
	SubscriptionID                 string `json:"subscriptionId"`
	ActiveDirectoryEndpointURL     string `json:"activeDirectoryEndpointUrl"`
	ResourceManagerEndpointURL     string `json:"resourceManagerEndpointUrl"`
	ActiveDirectoryGraphResourceID string `json:"activeDirectoryGraphResourceId"`
}

Credentials represents the contents of a JSON encoded Azure credentials file. It is a subset of the internal type used by the Azure auth library. https://github.com/Azure/go-autorest/blob/be17756/autorest/azure/auth/auth.go#L226

type FieldOption added in v0.2.0

type FieldOption int

A FieldOption determines how common Go types are translated to the types required by the Azure Go SDK.

const (
	// FieldRequired causes zero values to be converted to a pointer to the zero
	// value, rather than a nil pointer. Azure Go SDK types use pointer fields,
	// with a nil pointer indicating an unset field. Our ToPtr functions return
	// a nil pointer for a zero values, unless FieldRequired is set.
	FieldRequired FieldOption = iota
)

Field options.

type MySQLServerClient

type MySQLServerClient struct {
	mysql.ServersClient
	mysql.FirewallRulesClient
}

MySQLServerClient is the concreate implementation of the SQLServerAPI interface for MySQL that calls Azure API.

func NewMySQLServerClient

func NewMySQLServerClient(provider *v1alpha1.Provider, clientset kubernetes.Interface) (*MySQLServerClient, error)

NewMySQLServerClient creates and initializes a MySQLServerClient instance.

func (*MySQLServerClient) CreateFirewallRulesBegin

func (c *MySQLServerClient) CreateFirewallRulesBegin(ctx context.Context, instance azuredbv1alpha1.SQLServer, firewallRuleName string) ([]byte, error)

CreateFirewallRulesBegin begins the create operation for a firewall rule

func (*MySQLServerClient) CreateFirewallRulesEnd

func (c *MySQLServerClient) CreateFirewallRulesEnd(createOp []byte) (done bool, err error)

CreateFirewallRulesEnd checks to see if the given create operation is completed and if any error has occurred.

func (*MySQLServerClient) CreateServerBegin

func (c *MySQLServerClient) CreateServerBegin(ctx context.Context, instance azuredbv1alpha1.SQLServer, adminPassword string) ([]byte, error)

CreateServerBegin begins the create operation for a MySQL Server with the given properties.

func (*MySQLServerClient) CreateServerEnd

func (c *MySQLServerClient) CreateServerEnd(createOp []byte) (done bool, err error)

CreateServerEnd checks to see if the given create operation is completed and if any error has occurred.

func (*MySQLServerClient) DeleteServer

func (c *MySQLServerClient) DeleteServer(ctx context.Context, instance azuredbv1alpha1.SQLServer) (azurerest.Future, error)

DeleteServer deletes the given MySQLServer resource

func (*MySQLServerClient) GetFirewallRule

func (c *MySQLServerClient) GetFirewallRule(ctx context.Context, instance azuredbv1alpha1.SQLServer, firewallRuleName string) error

GetFirewallRule gets the given firewall rule

func (*MySQLServerClient) GetServer

func (c *MySQLServerClient) GetServer(ctx context.Context, instance azuredbv1alpha1.SQLServer) (*SQLServer, error)

GetServer retrieves the requested MySQL Server

type MySQLServerClientFactory

type MySQLServerClientFactory struct {
}

MySQLServerClientFactory implements the SQLServerAPIFactory by returning the concrete MySQLServerClient implementation

func (*MySQLServerClientFactory) CreateAPIInstance

func (f *MySQLServerClientFactory) CreateAPIInstance(provider *v1alpha1.Provider, clientset kubernetes.Interface) (SQLServerAPI, error)

CreateAPIInstance returns a concrete MySQLServerClient implementation

type PostgreSQLServerClient added in v0.2.0

type PostgreSQLServerClient struct {
	postgresql.ServersClient
	postgresql.FirewallRulesClient
}

PostgreSQLServerClient is the concreate implementation of the SQLServerAPI interface for PostgreSQL that calls Azure API.

func NewPostgreSQLServerClient added in v0.2.0

func NewPostgreSQLServerClient(provider *v1alpha1.Provider, clientset kubernetes.Interface) (*PostgreSQLServerClient, error)

NewPostgreSQLServerClient creates and initializes a PostgreSQLServerClient instance.

func (*PostgreSQLServerClient) CreateFirewallRulesBegin added in v0.2.0

func (c *PostgreSQLServerClient) CreateFirewallRulesBegin(ctx context.Context, instance azuredbv1alpha1.SQLServer, firewallRuleName string) ([]byte, error)

CreateFirewallRulesBegin begins the create operation for a firewall rule

func (*PostgreSQLServerClient) CreateFirewallRulesEnd added in v0.2.0

func (c *PostgreSQLServerClient) CreateFirewallRulesEnd(createOp []byte) (done bool, err error)

CreateFirewallRulesEnd checks to see if the given create operation is completed and if any error has occurred.

func (*PostgreSQLServerClient) CreateServerBegin added in v0.2.0

func (c *PostgreSQLServerClient) CreateServerBegin(ctx context.Context, instance azuredbv1alpha1.SQLServer, adminPassword string) ([]byte, error)

CreateServerBegin begins the create operation for a PostgreSQL Server with the given properties

func (*PostgreSQLServerClient) CreateServerEnd added in v0.2.0

func (c *PostgreSQLServerClient) CreateServerEnd(createOp []byte) (done bool, err error)

CreateServerEnd checks to see if the given create operation is completed and if any error has occurred.

func (*PostgreSQLServerClient) DeleteServer added in v0.2.0

DeleteServer deletes the given PostgreSQL resource

func (*PostgreSQLServerClient) GetFirewallRule added in v0.2.0

func (c *PostgreSQLServerClient) GetFirewallRule(ctx context.Context, instance azuredbv1alpha1.SQLServer, firewallRuleName string) error

GetFirewallRule gets the given firewall rule

func (*PostgreSQLServerClient) GetServer added in v0.2.0

GetServer retrieves the requested PostgreSQL Server

type PostgreSQLServerClientFactory added in v0.2.0

type PostgreSQLServerClientFactory struct {
}

PostgreSQLServerClientFactory implements the SQLServerAPIFactory by returning the concrete PostgreSQLServerClient implementation

func (*PostgreSQLServerClientFactory) CreateAPIInstance added in v0.2.0

func (f *PostgreSQLServerClientFactory) CreateAPIInstance(provider *v1alpha1.Provider, clientset kubernetes.Interface) (SQLServerAPI, error)

CreateAPIInstance returns a concrete PostgreSQLServerClient implementation

type SQLServer added in v0.2.0

type SQLServer struct {
	State string
	ID    string
	FQDN  string
}

SQLServer represents an SQL Server (MySQL, PostgreSQL) instance used in the Azure API

type SQLServerAPI added in v0.2.0

type SQLServerAPI interface {
	GetServer(ctx context.Context, instance azuredbv1alpha1.SQLServer) (*SQLServer, error)
	CreateServerBegin(ctx context.Context, instance azuredbv1alpha1.SQLServer, adminPassword string) ([]byte, error)
	CreateServerEnd(createOp []byte) (bool, error)
	DeleteServer(ctx context.Context, instance azuredbv1alpha1.SQLServer) (azurerest.Future, error)
	GetFirewallRule(ctx context.Context, instance azuredbv1alpha1.SQLServer, firewallRuleName string) (err error)
	CreateFirewallRulesBegin(ctx context.Context, instance azuredbv1alpha1.SQLServer, firewallRuleName string) ([]byte, error)
	CreateFirewallRulesEnd(createOp []byte) (bool, error)
}

SQLServerAPI represents the API interface for a SQL Server client

type SQLServerAPIFactory added in v0.2.0

type SQLServerAPIFactory interface {
	CreateAPIInstance(*v1alpha1.Provider, kubernetes.Interface) (SQLServerAPI, error)
}

SQLServerAPIFactory is an interface that can create instances of the SQLServerAPI interface

type ServicePrincipalAPI

type ServicePrincipalAPI interface {
	CreateServicePrincipal(ctx context.Context, spID, appID string) (*graphrbac.ServicePrincipal, error)
	DeleteServicePrincipal(ctx context.Context, spID string) error
}

ServicePrincipalAPI represents the API interface for an Azure service principal client

type ServicePrincipalClient

type ServicePrincipalClient struct {
	graphrbac.ServicePrincipalsClient
}

ServicePrincipalClient is the concreate implementation of the ServicePrincipalAPI interface that calls Azure API.

func NewServicePrincipalClient

func NewServicePrincipalClient(provider *v1alpha1.Provider, clientset kubernetes.Interface) (*ServicePrincipalClient, error)

NewServicePrincipalClient creates and initializes a ServicePrincipalClient instance.

func (*ServicePrincipalClient) CreateServicePrincipal

func (c *ServicePrincipalClient) CreateServicePrincipal(ctx context.Context, spID, appID string) (*graphrbac.ServicePrincipal, error)

CreateServicePrincipal creates a new service principal linked to the given AD application

func (*ServicePrincipalClient) DeleteServicePrincipal

func (c *ServicePrincipalClient) DeleteServicePrincipal(ctx context.Context, spID string) error

DeleteServicePrincipal will delete the given service principal

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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