Documentation ¶
Overview ¶
Package compute provides access to the Google Compute API.
Index ¶
- type Client
- type TestClient
- func (c *TestClient) CreateDisk(project, zone string, d *compute.Disk) error
- func (c *TestClient) CreateImage(project string, i *compute.Image) error
- func (c *TestClient) CreateInstance(project, zone string, i *compute.Instance) error
- func (c *TestClient) DeleteDisk(project, zone, name string) error
- func (c *TestClient) DeleteImage(project, name string) error
- func (c *TestClient) DeleteInstance(project, zone, name string) error
- func (c *TestClient) GetSerialPortOutput(project, zone, name string, port, start int64) (*compute.SerialPortOutput, error)
- func (c *TestClient) InstanceStatus(project, zone, name string) (string, error)
- func (c *TestClient) InstanceStopped(project, zone, name string) (bool, error)
- func (c *TestClient) WaitForInstanceStopped(project, zone, name string, interval time.Duration) error
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.
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.