Documentation ¶
Overview ¶
Package stubs provides testable stubs for clients.
Index ¶
- type ComputeStub
- func (c *ComputeStub) CreateSnapshot(ctx context.Context, _, _, disk string, rb *compute.Snapshot) (*compute.Operation, error)
- func (c *ComputeStub) DeleteDiskSnapshot(_, _ string) (*compute.Operation, error)
- func (c *ComputeStub) ListDisks(ctx context.Context, _, _ string) (*compute.DiskList, error)
- func (c *ComputeStub) ListProjectSnapshots(context.Context, string) (*compute.SnapshotList, error)
- func (c *ComputeStub) PatchFirewallRule(_, _ string, rb *compute.Firewall) (*compute.Operation, error)
- func (c *ComputeStub) SetLabels(context.Context, string, string, *compute.GlobalSetLabelsRequest) (*compute.Operation, error)
- func (c *ComputeStub) WaitGlobal(_ string, _ *compute.Operation) []error
- func (c *ComputeStub) WaitZone(_, _ string, _ *compute.Operation) []error
- type ResourceManagerStub
- func (s *ResourceManagerStub) GetAncestry(context.Context, string) (*crm.GetAncestryResponse, error)
- func (s *ResourceManagerStub) GetPolicyProject(ctx context.Context, projectID string) (*crm.Policy, error)
- func (s *ResourceManagerStub) SetPolicyProject(ctx context.Context, projectID string, p *crm.Policy) (*crm.Policy, error)
- type StorageStub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComputeStub ¶
type ComputeStub struct { SavedFirewallRule *compute.Firewall SavedCreateSnapshots map[string]compute.Snapshot StubbedListProjectSnapshots *compute.SnapshotList StubbedListDisks *compute.DiskList }
ComputeStub provides a stub for the compute client.
func (*ComputeStub) CreateSnapshot ¶
func (c *ComputeStub) CreateSnapshot(ctx context.Context, _, _, disk string, rb *compute.Snapshot) (*compute.Operation, error)
CreateSnapshot creates a snapshot of a specified persistent disk.
func (*ComputeStub) DeleteDiskSnapshot ¶
func (c *ComputeStub) DeleteDiskSnapshot(_, _ string) (*compute.Operation, error)
DeleteDiskSnapshot deletes a snapshot.
func (*ComputeStub) ListProjectSnapshots ¶
func (c *ComputeStub) ListProjectSnapshots(context.Context, string) (*compute.SnapshotList, error)
ListProjectSnapshots returns a list of snapshot resources.
func (*ComputeStub) PatchFirewallRule ¶
func (c *ComputeStub) PatchFirewallRule(_, _ string, rb *compute.Firewall) (*compute.Operation, error)
PatchFirewallRule updates the firewall rule for the given project.
func (*ComputeStub) SetLabels ¶
func (c *ComputeStub) SetLabels(context.Context, string, string, *compute.GlobalSetLabelsRequest) (*compute.Operation, error)
SetLabels sets the labels on a snapshot.
func (*ComputeStub) WaitGlobal ¶
func (c *ComputeStub) WaitGlobal(_ string, _ *compute.Operation) []error
WaitGlobal waits globally.
type ResourceManagerStub ¶
type ResourceManagerStub struct { GetPolicyResponse *crm.Policy GetAncestryResponse *crm.GetAncestryResponse SavedSetPolicy *crm.Policy }
ResourceManagerStub provides a stub for the CRM client.
func (*ResourceManagerStub) GetAncestry ¶
func (s *ResourceManagerStub) GetAncestry(context.Context, string) (*crm.GetAncestryResponse, error)
GetProjectAncestry is a stub of Cloud Resource Manager's GetAncestry.
func (*ResourceManagerStub) GetPolicyProject ¶
func (s *ResourceManagerStub) GetPolicyProject(ctx context.Context, projectID string) (*crm.Policy, error)
GetPolicyProject is a stub of Cloud Resource Manager's GetIamPolicy.
type StorageStub ¶
type StorageStub struct { RemovedBucketUsers storage.ACLEntity // contains filtered or unexported fields }
StorageStub provides a stub for the Storage client.
func (*StorageStub) RemoveBucketUsers ¶
func (s *StorageStub) RemoveBucketUsers(ctx context.Context, bucketName string, entity storage.ACLEntity) error
RemoveBucketUsers removes the users from the given bucket.