Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New("cloud: not implemented")
ErrNotImplemented is the error returned if a method is not implemented.
Functions ¶
func Register ¶
func Register(name ProviderName, factory Factory)
Register registers a cloud provider factory by name.
The cloud MUST have a name: lower case and one word.
Types ¶
type ComputeInterface ¶ added in v0.0.10
type ComputeInterface interface { // DescribeRegions returns a list of regions. DescribeRegions(ctx context.Context) ([]*Region, error) // DescribeZones returns a list of availability zones within a region. DescribeZones(ctx context.Context) ([]*Zone, error) // DescribeVPCs returns a list of VPCs within a region. DescribeVPCs(ctx context.Context) ([]*VPC, error) // DescribeSubnets returns a list of subnets within a VPC. DescribeSubnets(ctx context.Context, vpcID string) ([]*Subnet, error) }
ComputeInterface defines the interface of the Compute Services API.
type Factory ¶
type Factory func(options ...ProviderOption) (Interface, error)
Factory is a function that returns a Provider interface. An error is returned if the cloud provider fails to initialize, nil otherwise.
func GetFactory ¶
func GetFactory(name ProviderName) (Factory, error)
GetFactory returns a factory of cloud provider by name.
type Interface ¶
type Interface interface { // Name returns the cloud provider name. Name() ProviderName // Compute returns an instance of Compute interface. Compute() ComputeInterface // Storage returns an instance of Storage interface. Storage() StorageInterface }
Interface defines the interface that should be implemented by a cloud provider.
func GetInstance ¶
func GetInstance(name ProviderName, options ...ProviderOption) (Interface, error)
GetInstance returns an instance of cloud provider by name.
type ProviderOption ¶ added in v0.0.10
type ProviderOption func(*ProviderOptions)
ProviderOption allows specifying various settings configurable by the provider.
func WithProfile ¶ added in v0.0.10
func WithProfile(profile string) ProviderOption
WithProfile specifies credentials profile to use.
func WithRegion ¶ added in v0.0.10
func WithRegion(region string) ProviderOption
WithRegion specifies the region to use.
type ProviderOptions ¶ added in v0.0.10
type ProviderOptions struct { // Credentials profile. Profile string // Region name. Region string // DryRun configures the provider to print the actions that would be executed, // without executing them. DryRun bool }
func DefaultProviderOptions ¶ added in v0.0.10
func DefaultProviderOptions() *ProviderOptions
DefaultProviderOptions returns the default provider options.
type StorageInterface ¶ added in v0.0.10
type StorageInterface interface { // GetBucket returns a bucket by name. GetBucket(ctx context.Context, bucket string) (*Bucket, error) // CreateBucket creates a new bucket. CreateBucket(ctx context.Context, bucket string) (*Bucket, error) }
StorageInterface defines the interface of the Storage Services API.