gcp

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2017 License: Apache-2.0 Imports: 10 Imported by: 4

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) (string, error)

func (*Client) CreateVM added in v0.1.2

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

func (*Client) DeleteVM added in v0.1.2

func (s *Client) DeleteVM(instanceName string) 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) 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)
	StopVM(instanceName string) error
	CreateImage(tarball string) (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)
	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
This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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