cloud

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 Bucket added in v0.0.10

type Bucket struct {
	Name   string
	Region string
}

Describes a bucket.

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 ProviderName

type ProviderName string

ProviderName represents the name of a cloud provider.

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 Region

type Region struct {
	Name string
}

Describes a region.

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.

type Subnet

type Subnet struct {
	ID   string
	Name string
}

Describes a subnet.

type VPC

type VPC struct {
	ID   string
	Name string
}

Describes a VPC.

type Zone

type Zone struct {
	ID   string
	Name string
}

Describes a zone.

Directories

Path Synopsis
aws

Jump to

Keyboard shortcuts

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