compute

package
v0.0.0-...-c2ad91b Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package compute provides access to the Google Compute API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateDisk(project, zone string, d *compute.Disk) error
	CreateImage(project string, i *compute.Image) error
	CreateInstance(project, zone string, i *compute.Instance) error
	DeleteDisk(project, zone, name string) error
	DeleteImage(project, name string) error
	DeleteInstance(project, zone, name string) error
	GetSerialPortOutput(project, zone, name string, port, start int64) (*compute.SerialPortOutput, error)
	InstanceStatus(project, zone, name string) (string, error)
	InstanceStopped(project, zone, name string) (bool, error)
	WaitForInstanceStopped(project, zone, name string, interval time.Duration) error
}

Client is a client for interacting with Google Cloud Compute.

func NewClient

func NewClient(ctx context.Context, opts ...option.ClientOption) (Client, error)

NewClient creates a new Google Cloud Compute client.

type TestClient

type TestClient struct {
	CreateDiskFn             func(project, zone string, d *compute.Disk) error
	CreateImageFn            func(project string, i *compute.Image) error
	CreateInstanceFn         func(project, zone string, i *compute.Instance) error
	DeleteDiskFn             func(project, zone, name string) error
	DeleteImageFn            func(project, name string) error
	DeleteInstanceFn         func(project, zone, name string) error
	GetSerialPortOutputFn    func(project, zone, name string, port, start int64) (*compute.SerialPortOutput, error)
	InstanceStatusFn         func(project, zone, name string) (string, error)
	InstanceStoppedFn        func(project, zone, name string) (bool, error)
	WaitForInstanceStoppedFn func(project, zone, name string, interval time.Duration) error
	// contains filtered or unexported fields
}

TestClient is a Client with overrideable methods.

func NewTestClient

func NewTestClient(handleFunc http.HandlerFunc) (*httptest.Server, *TestClient, error)

NewTestClient returns a TestClient with a replacement http handler function. Methods on the new TestClient are overrideable as well.

func (*TestClient) CreateDisk

func (c *TestClient) CreateDisk(project, zone string, d *compute.Disk) error

CreateDisk uses the override method CreateDiskFn or the real implementation.

func (*TestClient) CreateImage

func (c *TestClient) CreateImage(project string, i *compute.Image) error

CreateImage uses the override method CreateImageFn or the real implementation.

func (*TestClient) CreateInstance

func (c *TestClient) CreateInstance(project, zone string, i *compute.Instance) error

CreateInstance uses the override method CreateInstanceFn or the real implementation.

func (*TestClient) DeleteDisk

func (c *TestClient) DeleteDisk(project, zone, name string) error

DeleteDisk uses the override method DeleteDiskFn or the real implementation.

func (*TestClient) DeleteImage

func (c *TestClient) DeleteImage(project, name string) error

DeleteImage uses the override method DeleteImageFn or the real implementation.

func (*TestClient) DeleteInstance

func (c *TestClient) DeleteInstance(project, zone, name string) error

DeleteInstance uses the override method DeleteInstanceFn or the real implementation.

func (*TestClient) GetSerialPortOutput

func (c *TestClient) GetSerialPortOutput(project, zone, name string, port, start int64) (*compute.SerialPortOutput, error)

GetSerialPortOutput uses the override method GetSerialPortOutputFn or the real implementation.

func (*TestClient) InstanceStatus

func (c *TestClient) InstanceStatus(project, zone, name string) (string, error)

InstanceStatus uses the override method InstanceStatusFn or the real implementation.

func (*TestClient) InstanceStopped

func (c *TestClient) InstanceStopped(project, zone, name string) (bool, error)

InstanceStopped uses the override method InstanceStoppedFn or the real implementation.

func (*TestClient) WaitForInstanceStopped

func (c *TestClient) WaitForInstanceStopped(project, zone, name string, interval time.Duration) error

WaitForInstanceStopped uses the override method WaitForInstanceStoppedFn or the real implementation.

Jump to

Keyboard shortcuts

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