azure

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UserAgent is the user agent addition 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 MySQLServerVirtualNetworkRuleNeedsUpdate

func MySQLServerVirtualNetworkRuleNeedsUpdate(kube *azuredbv1alpha2.MysqlServerVirtualNetworkRule, az mysql.VirtualNetworkRule) bool

MySQLServerVirtualNetworkRuleNeedsUpdate determines if a virtual network rule needs to be updated

func MySQLVirtualNetworkRuleStatusFromAzure

func MySQLVirtualNetworkRuleStatusFromAzure(az mysql.VirtualNetworkRule) azuredbv1alpha2.VirtualNetworkRuleStatus

MySQLVirtualNetworkRuleStatusFromAzure converts an Azure subnet to a SubnetStatus

func NewMySQLVirtualNetworkRuleParameters

func NewMySQLVirtualNetworkRuleParameters(v *azuredbv1alpha2.MysqlServerVirtualNetworkRule) mysql.VirtualNetworkRule

NewMySQLVirtualNetworkRuleParameters returns an Azure VirtualNetworkRule object from a virtual network spec

func NewPostgreSQLVirtualNetworkRuleParameters

func NewPostgreSQLVirtualNetworkRuleParameters(v *azuredbv1alpha2.PostgresqlServerVirtualNetworkRule) postgresql.VirtualNetworkRule

NewPostgreSQLVirtualNetworkRuleParameters returns an Azure VirtualNetworkRule object from a virtual network spec

func PostgreSQLServerVirtualNetworkRuleNeedsUpdate

func PostgreSQLServerVirtualNetworkRuleNeedsUpdate(kube *azuredbv1alpha2.PostgresqlServerVirtualNetworkRule, az postgresql.VirtualNetworkRule) bool

PostgreSQLServerVirtualNetworkRuleNeedsUpdate determines if a virtual network rule needs to be updated

func PostgreSQLVirtualNetworkRuleStatusFromAzure

func PostgreSQLVirtualNetworkRuleStatusFromAzure(az postgresql.VirtualNetworkRule) azuredbv1alpha2.VirtualNetworkRuleStatus

PostgreSQLVirtualNetworkRuleStatusFromAzure converts an Azure subnet to a SubnetStatus

func SQLServerCondition

func SQLServerCondition(state string) runtimev1alpha1.Condition

SQLServerCondition converts the given MySQL Server state string into a corresponding condition.

func SQLServerSkuName

func SQLServerSkuName(pricingTier azuredbv1alpha2.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

func SQLServerStatusMessage(instanceName string, state string) string

SQLServerStatusMessage returns a status message based on the given server state

func ToBoolPtr

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

func ToInt(i *int32) int

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

func ToInt32Ptr

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

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

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

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

func ToStringPtrMap

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 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 *v1alpha2.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 *v1alpha2.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

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

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 *v1alpha2.Provider, clientset kubernetes.Interface) (*MySQLServerClient, error)

NewMySQLServerClient creates and initializes a MySQLServerClient instance.

func (*MySQLServerClient) CreateFirewallRulesBegin

func (c *MySQLServerClient) CreateFirewallRulesBegin(ctx context.Context, instance azuredbv1alpha2.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 azuredbv1alpha2.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 azuredbv1alpha2.SQLServer) (azurerest.Future, error)

DeleteServer deletes the given MySQLServer resource

func (*MySQLServerClient) GetFirewallRule

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

GetFirewallRule gets the given firewall rule

func (*MySQLServerClient) GetServer

func (c *MySQLServerClient) GetServer(ctx context.Context, instance azuredbv1alpha2.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 *v1alpha2.Provider, clientset kubernetes.Interface) (SQLServerAPI, error)

CreateAPIInstance returns a concrete MySQLServerClient implementation

type MySQLVirtualNetworkRulesClient

type MySQLVirtualNetworkRulesClient mysqlapi.VirtualNetworkRulesClientAPI

A MySQLVirtualNetworkRulesClient handles CRUD operations for Azure Virtual Network Rules.

func NewMySQLVirtualNetworkRulesClient

func NewMySQLVirtualNetworkRulesClient(ctx context.Context, credentials []byte) (MySQLVirtualNetworkRulesClient, error)

NewMySQLVirtualNetworkRulesClient returns a new Azure Virtual Network Rules client. Credentials must be passed as JSON encoded data.

type PostgreSQLServerClient

type PostgreSQLServerClient struct {
	postgresql.ServersClient
	postgresql.FirewallRulesClient
}

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

func NewPostgreSQLServerClient

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

NewPostgreSQLServerClient creates and initializes a PostgreSQLServerClient instance.

func (*PostgreSQLServerClient) CreateFirewallRulesBegin

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

CreateFirewallRulesBegin begins the create operation for a firewall rule

func (*PostgreSQLServerClient) CreateFirewallRulesEnd

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

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

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

func (*PostgreSQLServerClient) CreateServerEnd

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

DeleteServer deletes the given PostgreSQL resource

func (*PostgreSQLServerClient) GetFirewallRule

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

GetFirewallRule gets the given firewall rule

func (*PostgreSQLServerClient) GetServer

GetServer retrieves the requested PostgreSQL Server

type PostgreSQLServerClientFactory

type PostgreSQLServerClientFactory struct {
}

PostgreSQLServerClientFactory implements the SQLServerAPIFactory by returning the concrete PostgreSQLServerClient implementation

func (*PostgreSQLServerClientFactory) CreateAPIInstance

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

CreateAPIInstance returns a concrete PostgreSQLServerClient implementation

type PostgreSQLVirtualNetworkRulesClient

type PostgreSQLVirtualNetworkRulesClient postgresqlapi.VirtualNetworkRulesClientAPI

A PostgreSQLVirtualNetworkRulesClient handles CRUD operations for Azure Virtual Network Rules.

func NewPostgreSQLVirtualNetworkRulesClient

func NewPostgreSQLVirtualNetworkRulesClient(ctx context.Context, credentials []byte) (PostgreSQLVirtualNetworkRulesClient, error)

NewPostgreSQLVirtualNetworkRulesClient returns a new Azure Virtual Network Rules client. Credentials must be passed as JSON encoded data.

type SQLServer

type SQLServer struct {
	State string
	ID    string
	FQDN  string
}

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

type SQLServerAPI

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

SQLServerAPI represents the API interface for a SQL Server client

type SQLServerAPIFactory

type SQLServerAPIFactory interface {
	CreateAPIInstance(*v1alpha2.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 *v1alpha2.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