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) GetDisk(project, zone, name string) (*compute.Disk, error)
- func (c *TestClient) GetImage(project, name string) (*compute.Image, error)
- func (c *TestClient) GetInstance(project, zone, name string) (*compute.Instance, error)
- func (c *TestClient) GetMachineType(project, zone, machineType string) (*compute.MachineType, error)
- func (c *TestClient) GetProject(project string) (*compute.Project, error)
- func (c *TestClient) GetSerialPortOutput(project, zone, name string, port, start int64) (*compute.SerialPortOutput, error)
- func (c *TestClient) GetZone(project, zone string) (*compute.Zone, error)
- func (c *TestClient) InstanceStatus(project, zone, name string) (string, error)
- func (c *TestClient) InstanceStopped(project, zone, name string) (bool, error)
- func (c *TestClient) Retry(f func(opts ...googleapi.CallOption) (*compute.Operation, error), ...) (op *compute.Operation, err 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
GetMachineType(project, zone, machineType string) (*compute.MachineType, error)
GetProject(project string) (*compute.Project, error)
GetSerialPortOutput(project, zone, name string, port, start int64) (*compute.SerialPortOutput, error)
GetZone(project, zone string) (*compute.Zone, error)
GetInstance(project, zone, name string) (*compute.Instance, error)
GetDisk(project, zone, name string) (*compute.Disk, error)
GetImage(project, name string) (*compute.Image, error)
InstanceStatus(project, zone, name string) (string, error)
InstanceStopped(project, zone, name string) (bool, error)
Retry(f func(opts ...googleapi.CallOption) (*compute.Operation, error), opts ...googleapi.CallOption) (op *compute.Operation, err 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
GetMachineTypeFn func(project, zone, machineType string) (*compute.MachineType, error)
GetProjectFn func(project string) (*compute.Project, error)
GetSerialPortOutputFn func(project, zone, name string, port, start int64) (*compute.SerialPortOutput, error)
GetZoneFn func(project, zone string) (*compute.Zone, error)
GetInstanceFn func(project, zone, name string) (*compute.Instance, error)
GetDiskFn func(project, zone, name string) (*compute.Disk, error)
GetImageFn func(project, name string) (*compute.Image, error)
InstanceStatusFn func(project, zone, name string) (string, error)
InstanceStoppedFn func(project, zone, name string) (bool, error)
RetryFn func(f func(opts ...googleapi.CallOption) (*compute.Operation, error), opts ...googleapi.CallOption) (op *compute.Operation, err 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) GetDisk ¶
func (c *TestClient) GetDisk(project, zone, name string) (*compute.Disk, error)
GetDisk uses the override method GetZoneFn or the real implementation.
func (*TestClient) GetImage ¶
func (c *TestClient) GetImage(project, name string) (*compute.Image, error)
GetImage uses the override method GetZoneFn or the real implementation.
func (*TestClient) GetInstance ¶
func (c *TestClient) GetInstance(project, zone, name string) (*compute.Instance, error)
GetInstance uses the override method GetZoneFn or the real implementation.
func (*TestClient) GetMachineType ¶
func (c *TestClient) GetMachineType(project, zone, machineType string) (*compute.MachineType, error)
GetMachineType uses the override method GetMachineTypeFn or the real implementation.
func (*TestClient) GetProject ¶
func (c *TestClient) GetProject(project string) (*compute.Project, error)
GetProject uses the override method GetProjectFn 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) GetZone ¶
func (c *TestClient) GetZone(project, zone string) (*compute.Zone, error)
GetZone uses the override method GetZoneFn 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) Retry ¶
func (c *TestClient) Retry(f func(opts ...googleapi.CallOption) (*compute.Operation, error), opts ...googleapi.CallOption) (op *compute.Operation, err error)
CreateDisk uses the override method CreateDiskFn or the real implementation.