Documentation
¶
Index ¶
- Constants
- Variables
- type APIVersions
- type AppLock
- type AzureConfig
- type AzureRESTClient
- type AzureStackConfig
- type AzureStorageAccountRESTClient
- type AzureStorageAccountSDKClient
- type AzureStorageSDKClient
- func (c *AzureStorageSDKClient) CreateFileShare(fileShareName string) error
- func (c *AzureStorageSDKClient) DeleteFileShare(fileShareName string) error
- func (c *AzureStorageSDKClient) DeleteStorageAccount() error
- func (c *AzureStorageSDKClient) Exists() (bool, error)
- func (c *AzureStorageSDKClient) GetAccessKey() (string, error)
- func (c *AzureStorageSDKClient) GetShareURL(fileShareName string) (string, error)
- func (c *AzureStorageSDKClient) HasFileShare(fileShareName string) (bool, error)
- type AzureToken
- type BindOptions
- type Broker
- func (b *Broker) Bind(context context.Context, instanceID string, bindingID string, ...) (_ brokerapi.Binding, e error)
- func (b *Broker) Deprovision(context context.Context, instanceID string, ...) (_ brokerapi.DeprovisionServiceSpec, e error)
- func (b *Broker) LastOperation(_ context.Context, instanceID string, operationData string) (brokerapi.LastOperation, error)
- func (b *Broker) Provision(context context.Context, instanceID string, details brokerapi.ProvisionDetails, ...) (_ brokerapi.ProvisionedServiceSpec, e error)
- func (b *Broker) Services(_ context.Context) []brokerapi.Service
- func (b *Broker) Unbind(context context.Context, instanceID string, bindingID string, ...) (e error)
- func (b *Broker) Update(context context.Context, instanceID string, details brokerapi.UpdateDetails, ...) (brokerapi.UpdateServiceSpec, error)
- type CloudConfig
- type Config
- type Configuration
- type ControlConfig
- type DBInitialize
- type Environment
- type FileShare
- type MountConfig
- type ServiceInstance
- type SqlConnection
- type SqlStore
- func (s *SqlStore) CreateBindingDetails(id string, details brokerapi.BindDetails, redactRawParameter bool) error
- func (s *SqlStore) CreateFileShare(id string, share FileShare) error
- func (s *SqlStore) CreateServiceInstance(id string, instance ServiceInstance) error
- func (s *SqlStore) DeleteBindingDetails(id string) error
- func (s *SqlStore) DeleteFileShare(id string) error
- func (s *SqlStore) DeleteServiceInstance(id string) error
- func (s *SqlStore) GetLockForUpdate(lockName string, seconds int) error
- func (s *SqlStore) ReleaseLockForUpdate(lockName string) error
- func (s *SqlStore) RetrieveBindingDetails(id string) (brokerapi.BindDetails, error)
- func (s *SqlStore) RetrieveFileShare(id string) (FileShare, error)
- func (s *SqlStore) RetrieveServiceInstance(id string) (ServiceInstance, error)
- func (s *SqlStore) UpdateFileShare(id string, share FileShare) error
- type SqlVariant
- type StorageAccount
- type Store
Constants ¶
const ( AzureCloud = "AzureCloud" AzureChinaCloud = "AzureChinaCloud" AzureGermanCloud = "AzureGermanCloud" AzureUSGovernment = "AzureUSGovernment" AzureStack = "AzureStack" )
Variables ¶
var Environments = map[string]Environment{ AzureCloud: Environment{ ResourceManagerEndpointURL: "https://management.azure.com/", ActiveDirectoryEndpointURL: "https://login.microsoftonline.com", APIVersions: APIVersions{ StorageForREST: "2016-12-01", StorageForSDK: "2016-05-31", ActiveDirectory: "2015-06-15", }, }, AzureChinaCloud: Environment{ ResourceManagerEndpointURL: "https://management.chinacloudapi.cn/", ActiveDirectoryEndpointURL: "https://login.chinacloudapi.cn", APIVersions: APIVersions{ StorageForREST: "2016-12-01", StorageForSDK: "2016-05-31", ActiveDirectory: "2015-06-15", }, }, AzureUSGovernment: Environment{ ResourceManagerEndpointURL: "https://management.usgovcloudapi.net/", ActiveDirectoryEndpointURL: "https://login.microsoftonline.com", APIVersions: APIVersions{ StorageForREST: "2016-12-01", StorageForSDK: "2016-05-31", ActiveDirectory: "2015-06-15", }, }, AzureGermanCloud: Environment{ ResourceManagerEndpointURL: "https://management.microsoftazure.de/", ActiveDirectoryEndpointURL: "https://login.microsoftonline.de", APIVersions: APIVersions{ StorageForREST: "2016-12-01", StorageForSDK: "2016-05-31", ActiveDirectory: "2015-06-15", }, }, AzureStack: Environment{ APIVersions: APIVersions{ StorageForREST: "2016-12-01", StorageForSDK: "2016-05-31", ActiveDirectory: "2015-06-15", }, }, }
Functions ¶
This section is empty.
Types ¶
type APIVersions ¶
type AzureConfig ¶
type AzureConfig struct { Environment string TenanID string ClientID string ClientSecret string DefaultSubscriptionID string DefaultResourceGroupName string DefaultLocation string }
func NewAzureConfig ¶
func NewAzureConfig(environment, tenanID, clientID, clientSecret, defaultSubscriptionID, defaultResourceGroupName, defaultLocation string) *AzureConfig
func (*AzureConfig) IsSupportAzureFileShare ¶
func (config *AzureConfig) IsSupportAzureFileShare() bool
func (*AzureConfig) Validate ¶
func (config *AzureConfig) Validate() error
type AzureRESTClient ¶
type AzureRESTClient struct {
// contains filtered or unexported fields
}
func (*AzureRESTClient) CheckCompletion ¶
func (c *AzureRESTClient) CheckCompletion(asyncURL string) (bool, error)
CheckCompletion Check whether an asynchronous operation finishes or not
func (*AzureRESTClient) CreateStorageAccount ¶
func (c *AzureRESTClient) CreateStorageAccount() (string, error)
CreateStorageAccount Create a storage account. You need to call CheckCompletion to check whether the creation is finished. Return "", nil when the storage account has been created. Return "operation-url", nil when the storage account is still in creating. Reference: https://docs.microsoft.com/en-us/rest/api/storagerp/storageaccounts#StorageAccounts_Create
type AzureStackConfig ¶
type AzureStackConfig struct { AzureStackDomain string AzureStackAuthentication string AzureStackResource string AzureStackEndpointPrefix string }
func NewAzureStackConfig ¶
func NewAzureStackConfig(azureStackDomain, azureStackAuthentication, azureStackResource, azureStackEndpointPrefix string) *AzureStackConfig
func (*AzureStackConfig) Validate ¶
func (config *AzureStackConfig) Validate() error
type AzureStorageAccountRESTClient ¶
type AzureStorageAccountRESTClient interface { CreateStorageAccount() (string, error) CheckCompletion(asyncURL string) (bool, error) }
func NewAzureStorageAccountRESTClient ¶
func NewAzureStorageAccountRESTClient(logger lager.Logger, cloudConfig *CloudConfig, storageAccount *StorageAccount) (AzureStorageAccountRESTClient, error)
type AzureStorageAccountSDKClient ¶
type AzureStorageAccountSDKClient interface { Exists() (bool, error) GetAccessKey() (string, error) DeleteStorageAccount() error }
func NewAzureStorageAccountSDKClient ¶
func NewAzureStorageAccountSDKClient(logger lager.Logger, cloudConfig *CloudConfig, storageAccount *StorageAccount) (AzureStorageAccountSDKClient, error)
type AzureStorageSDKClient ¶
type AzureStorageSDKClient struct { StorageAccount *StorageAccount // contains filtered or unexported fields }
func (*AzureStorageSDKClient) CreateFileShare ¶
func (c *AzureStorageSDKClient) CreateFileShare(fileShareName string) error
func (*AzureStorageSDKClient) DeleteFileShare ¶
func (c *AzureStorageSDKClient) DeleteFileShare(fileShareName string) error
func (*AzureStorageSDKClient) DeleteStorageAccount ¶
func (c *AzureStorageSDKClient) DeleteStorageAccount() error
func (*AzureStorageSDKClient) Exists ¶
func (c *AzureStorageSDKClient) Exists() (bool, error)
func (*AzureStorageSDKClient) GetAccessKey ¶
func (c *AzureStorageSDKClient) GetAccessKey() (string, error)
func (*AzureStorageSDKClient) GetShareURL ¶
func (c *AzureStorageSDKClient) GetShareURL(fileShareName string) (string, error)
func (*AzureStorageSDKClient) HasFileShare ¶
func (c *AzureStorageSDKClient) HasFileShare(fileShareName string) (bool, error)
type AzureToken ¶
type BindOptions ¶
type BindOptions struct { UID string `json:"uid"` GID string `json:"gid"` FileMode string `json:"file_mode"` DirMode string `json:"dir_mode"` Readonly bool `json:"readonly"` Mount string `json:"mount"` Vers string `json:"vers"` // Required for AzureFileShare Domain string `json:"domain"` // Optional for preexisting shares Username string `json:"username"` // Required for preexisting shares Password string `json:"password"` // Optional for preexisting shares Sec string `json:"sec"` // Optional for preexisting shares }
func (BindOptions) ToMap ¶
func (options BindOptions) ToMap() map[string]string
ToMap Omit Mount, FileShareName, Domain, Username and Password
func (BindOptions) Validate ¶
func (options BindOptions) Validate(isPreexisting bool) error
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
func (*Broker) Deprovision ¶
func (b *Broker) Deprovision(context context.Context, instanceID string, details brokerapi.DeprovisionDetails, asyncAllowed bool) (_ brokerapi.DeprovisionServiceSpec, e error)
func (*Broker) LastOperation ¶
func (*Broker) Provision ¶
func (b *Broker) Provision(context context.Context, instanceID string, details brokerapi.ProvisionDetails, asyncAllowed bool) (_ brokerapi.ProvisionedServiceSpec, e error)
Provision Create a service instance which is mapped to a storage account or preexisting shares For AzureFileShare: UseHTTPS must be set to false. Otherwise, the mount in Linux will fail. https://docs.microsoft.com/en-us/azure/storage/storage-security-guide
type CloudConfig ¶
type CloudConfig struct { Azure AzureConfig Control ControlConfig AzureStack AzureStackConfig }
func NewAzurefilebrokerCloudConfig ¶
func NewAzurefilebrokerCloudConfig(azure *AzureConfig, control *ControlConfig, azureStack *AzureStackConfig) *CloudConfig
func (*CloudConfig) Validate ¶
func (config *CloudConfig) Validate() error
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func NewAzurefilebrokerConfig ¶
func NewAzurefilebrokerConfig(mountConfig *MountConfig, cloudConfig *CloudConfig) *Config
type Configuration ¶
type Configuration struct { SubscriptionID string `json:"subscription_id"` ResourceGroupName string `json:"resource_group_name"` StorageAccountName string `json:"storage_account_name"` // Required for AzureFileShare Location string `json:"location"` UseHTTPS string `json:"use_https"` // bool SkuName string `json:"sku_name"` CustomDomainName string `json:"custom_domain_name"` UseSubDomain string `json:"use_sub_domain"` // bool EnableEncryption string `json:"enable_encryption"` // bool }
TBD: custom_domain_name and use_sub_domain are not supported now.
func (*Configuration) ValidateForAzureFileShare ¶
func (config *Configuration) ValidateForAzureFileShare() error
type ControlConfig ¶
func NewControlConfig ¶
func NewControlConfig(allowCreateStorageAccount, allowCreateFileShare, allowDeleteStorageAccount, allowDeleteFileShare bool) *ControlConfig
type DBInitialize ¶
type DBInitialize interface {
GetInitializeDatabaseSQL() []string
}
type Environment ¶
type Environment struct { ResourceManagerEndpointURL string ActiveDirectoryEndpointURL string APIVersions APIVersions }
type MountConfig ¶
func NewAzurefilebrokerMountConfig ¶
func NewAzurefilebrokerMountConfig() *MountConfig
func (*MountConfig) Copy ¶
func (config *MountConfig) Copy() *MountConfig
func (MountConfig) MakeConfig ¶
func (config MountConfig) MakeConfig() map[string]interface{}
func (*MountConfig) ReadConf ¶
func (config *MountConfig) ReadConf(allowedFlag string, defaultFlag string) error
func (*MountConfig) SetEntries ¶
func (config *MountConfig) SetEntries(opts map[string]string) error
type ServiceInstance ¶
type ServiceInstance struct { ServiceID string `json:"service_id"` PlanID string `json:"plan_id"` OrganizationGUID string `json:"organization_guid"` SpaceGUID string `json:"space_guid"` TargetName string `json:"target_name"` // AzureFileShare: StorageAccountName; Preexisting shares: Share URL IsPreexisting bool `json:"is_preexisting"` // True when preexisting shares are used; False when AzureFileShare is used. SubscriptionID string `json:"subscription_id"` ResourceGroupName string `json:"resource_group_name"` UseHTTPS string `json:"use_https"` IsCreatedStorageAccount bool `json:"is_created_storage_account"` OperationURL string `json:"operation_url"` DatabaseVersion string `json:"database_version"` }
type SqlConnection ¶
type SqlConnection interface { Connect() error sqlshim.SqlDB DBInitialize AppLock }
func NewSqlConnection ¶
func NewSqlConnection(variant SqlVariant) SqlConnection
type SqlStore ¶
type SqlStore struct { StoreType string Database SqlConnection }
func (*SqlStore) CreateBindingDetails ¶
func (*SqlStore) CreateFileShare ¶
func (*SqlStore) CreateServiceInstance ¶
func (s *SqlStore) CreateServiceInstance(id string, instance ServiceInstance) error
func (*SqlStore) DeleteBindingDetails ¶
func (*SqlStore) DeleteFileShare ¶
func (*SqlStore) DeleteServiceInstance ¶
func (*SqlStore) GetLockForUpdate ¶
func (*SqlStore) ReleaseLockForUpdate ¶
func (*SqlStore) RetrieveBindingDetails ¶
func (s *SqlStore) RetrieveBindingDetails(id string) (brokerapi.BindDetails, error)
func (*SqlStore) RetrieveFileShare ¶
func (*SqlStore) RetrieveServiceInstance ¶
func (s *SqlStore) RetrieveServiceInstance(id string) (ServiceInstance, error)
type SqlVariant ¶
type SqlVariant interface { Connect() (sqlshim.SqlDB, error) DBInitialize AppLock }
func NewMSSqlVariant ¶
func NewMSSqlVariant(logger lager.Logger, username, password, host, port, dbName, caCert, hostNameInCertificate string) SqlVariant
func NewMySqlVariant ¶
func NewMySqlVariant(logger lager.Logger, username, password, host, port, dbName, caCert, hostNameInCertificate string) SqlVariant
type StorageAccount ¶
type StorageAccount struct { SubscriptionID string ResourceGroupName string StorageAccountName string UseHTTPS bool EnableEncryption bool SkuName storage.SkuName Location string IsCreatedStorageAccount bool AccessKey string BaseURL string OperationURL string SDKClient AzureStorageAccountSDKClient }
func NewStorageAccount ¶
func NewStorageAccount(logger lager.Logger, configuration Configuration) (*StorageAccount, error)
type Store ¶
type Store interface { RetrieveServiceInstance(id string) (ServiceInstance, error) RetrieveBindingDetails(id string) (brokerapi.BindDetails, error) CreateServiceInstance(id string, instance ServiceInstance) error CreateBindingDetails(id string, details brokerapi.BindDetails, redactRawParameter bool) error DeleteServiceInstance(id string) error DeleteBindingDetails(id string) error GetLockForUpdate(lockName string, timeoutInSeconds int) error ReleaseLockForUpdate(lockName string) error }