cloud

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: Apache-2.0 Imports: 4 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 Factory

type Factory func() (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

	// DescribeRegions returns a list of regions.
	DescribeRegions() ([]*Region, error)

	// DescribeZones returns a list of availability zones within a region.
	DescribeZones(region string) ([]*Zone, error)

	// DescribeVPCs returns a list of VPCs within a region.
	DescribeVPCs(region string) ([]*VPC, error)

	// DescribeSubnets returns a list of subnets within a VPC.
	DescribeSubnets(region, vpcID string) ([]*Subnet, error)
}

Interface defines the interface that should be implemented by a cloud provider.

func GetInstance

func GetInstance(name ProviderName) (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 Region

type Region struct {
	Name string
}

Describes a region.

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