gcp

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstanceAll        = "ALL"
	InstanceRunning    = "RUNNING"
	InstanceTerminated = "TERMINATED"
	ImageReady         = "READY"
	ImageFailed        = "FAILED"
)

Variables

This section is empty.

Functions

func ConfigGoogleClient

func ConfigGoogleClient(value GoogleComputeClient) func(*Client) error

func ConfigProjectName

func ConfigProjectName(value string) func(*Client) error

func ConfigTimeout added in v0.1.2

func ConfigTimeout(value time.Duration) func(*Client) error

func ConfigZoneName

func ConfigZoneName(value string) func(*Client) error

Types

type Client added in v0.1.2

type Client struct {
	// contains filtered or unexported fields
}

func NewClient added in v0.1.2

func NewClient(configs ...func(*Client) error) (*Client, error)

func (*Client) CreateImage added in v0.1.8

func (s *Client) CreateImage(tarball string, diskSizeGB int64) (string, error)

func (*Client) CreateVM added in v0.1.2

func (s *Client) CreateVM(instance compute.Instance) error

func (*Client) Delete added in v0.2.4

func (c *Client) Delete(identifier string) error

Cliaas Client Interface

func (*Client) DeleteVM added in v0.1.2

func (s *Client) DeleteVM(instanceName string) error

func (*Client) Disk added in v0.2.4

func (s *Client) Disk(filter Filter) (*compute.Disk, error)

func (*Client) GetDisk added in v0.2.4

func (s *Client) GetDisk(identifier string) (iaas.Disk, error)

func (*Client) GetVMInfo added in v0.1.2

func (s *Client) GetVMInfo(filter Filter) (*compute.Instance, error)

GetVMInfo - gets the information on the first VM to match the given filter argument currently filter will only do a regex on teh tag||name regex fields against the List's result set

func (*Client) Replace added in v0.2.4

func (c *Client) Replace(identifier string, sourceImageTarballURL string, diskSizeGB int64) error

func (*Client) StopVM added in v0.1.2

func (s *Client) StopVM(instanceName string) error

StopVM - will try to stop the VM with the given name

func (*Client) WaitForStatus added in v0.1.2

func (s *Client) WaitForStatus(vmName string, desiredStatus string) error

type ClientAPI

type ClientAPI interface {
	CreateVM(instance compute.Instance) error
	DeleteVM(instanceName string) error
	GetVMInfo(filter Filter) (*compute.Instance, error)
	Disk(filter Filter) (*compute.Disk, error)
	StopVM(instanceName string) error
	CreateImage(tarball string, diskSizeGB int64) (string, error)
	WaitForStatus(vmName string, desiredStatus string) error
}

type Filter added in v0.1.2

type Filter struct {
	TagRegexString  string
	NameRegexString string
	Status          string
}

type GoogleComputeClient

type GoogleComputeClient interface {
	List(project string, zone string) (*compute.InstanceList, error)
	DiskList(project string, zone string) (*compute.DiskList, error)
	Delete(project string, zone string, instanceName string) (*compute.Operation, error)
	Insert(project string, zone string, instance *compute.Instance) (*compute.Operation, error)
	ImageInsert(project string, image *compute.Image, timeout time.Duration) (*compute.Operation, error)
	Stop(project string, zone string, instanceName string) (*compute.Operation, error)
}

func NewDefaultGoogleComputeClient

func NewDefaultGoogleComputeClient(credpath string) (GoogleComputeClient, error)

NewDefaultGoogleComputeClient -- builds a gcp client which connects to your gcp using `GOOGLE_APPLICATION_CREDENTIALS`

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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