Documentation ¶
Overview ¶
Package gcp allows interaction with Google Cloud Platform resources.
Index ¶
- func AddLabelsToInstance(t *testing.T, projectID string, zone string, instance string, ...)
- func AddLabelsToInstanceE(t *testing.T, projectID string, zone string, instance string, ...) error
- func AssertStorageBucketExists(t *testing.T, name string)
- func AssertStorageBucketExistsE(t *testing.T, name string) error
- func CreateStorageBucket(t *testing.T, projectID string, name string, attr *storage.BucketAttrs)
- func CreateStorageBucketE(t *testing.T, projectID string, name string, attr *storage.BucketAttrs) error
- func DeleteImage(t *testing.T, projectID string, imageID string)
- func DeleteImageE(t *testing.T, projectID string, imageID string) error
- func DeleteStorageBucket(t *testing.T, name string)
- func DeleteStorageBucketE(t *testing.T, name string) error
- func EmptyStorageBucket(t *testing.T, name string)
- func EmptyStorageBucketE(t *testing.T, name string) error
- func GetAllGcpRegions(t *testing.T) []string
- func GetAllGcpRegionsE(t *testing.T) ([]string, error)
- func GetAllGcpZones(t *testing.T) []string
- func GetAllGcpZonesE(t *testing.T) ([]string, error)
- func GetGoogleCredentialsFromEnvVar() string
- func GetGoogleProjectIDFromEnvVar() string
- func GetGoogleRegionFromEnvVar() string
- func GetInstanceIdsForInstanceGroup(t *testing.T, projectID string, zone string, groupName string) []string
- func GetInstanceIdsForInstanceGroupE(t *testing.T, projectID string, zone string, groupName string) ([]string, error)
- func GetLabelsForComputeInstance(t *testing.T, projectID string, zone string, instanceID string) map[string]string
- func GetLabelsForComputeInstanceE(t *testing.T, projectID string, zone string, instanceID string) (map[string]string, error)
- func GetPublicIPOfInstance(t *testing.T, projectID string, zone string, instanceID string) string
- func GetPublicIPOfInstanceE(t *testing.T, projectID string, zone string, instanceID string) (string, error)
- func GetRandomRegion(t *testing.T, approvedRegions []string, forbiddenRegions []string) string
- func GetRandomRegionE(t *testing.T, approvedRegions []string, forbiddenRegions []string) (string, error)
- func GetRandomZone(t *testing.T, approvedZones []string, forbiddenZones []string) string
- func GetRandomZoneE(t *testing.T, approvedZones []string, forbiddenZones []string) (string, error)
- func NewComputeService(t *testing.T) *compute.Service
- func NewComputeServiceE(t *testing.T) (*compute.Service, error)
- func ReadBucketObject(t *testing.T, bucketName string, filePath string) io.Reader
- func ReadBucketObjectE(t *testing.T, bucketName string, filePath string) (io.Reader, error)
- func WriteBucketObject(t *testing.T, bucketName string, filePath string, body io.Reader, ...) string
- func WriteBucketObjectE(t *testing.T, bucketName string, filePath string, body io.Reader, ...) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLabelsToInstance ¶
func AddLabelsToInstance(t *testing.T, projectID string, zone string, instance string, labels map[string]string)
AddLabelsToInstance adds the tags to the given taggable instance.
func AddLabelsToInstanceE ¶
func AddLabelsToInstanceE(t *testing.T, projectID string, zone string, instance string, labels map[string]string) error
AddLabelsToInstanceE adds the tags to the given taggable instance.
func AssertStorageBucketExists ¶
AssertStorageBucketExists checks if the given storage bucket exists and fails the test if it does not.
func AssertStorageBucketExistsE ¶
AssertStorageBucketExistsE checks if the given storage bucket exists and returns an error if it does not.
func CreateStorageBucket ¶
CreateStorageBucket creates a Google Cloud bucket with the given BucketAttrs. Note that Google Storage bucket names must be globally unique.
func CreateStorageBucketE ¶
func CreateStorageBucketE(t *testing.T, projectID string, name string, attr *storage.BucketAttrs) error
CreateStorageBucketE creates a Google Cloud bucket with the given BucketAttrs. Note that Google Storage bucket names must be globally unique.
func DeleteImage ¶
DeleteImage deletes the given Compute Image.
func DeleteImageE ¶
DeleteImageE deletes the given Compute Image.
func DeleteStorageBucket ¶
DeleteStorageBucket destroys the Google Storage bucket.
func DeleteStorageBucketE ¶
DeleteStorageBucketE destroys the S3 bucket in the given region with the given name.
func EmptyStorageBucket ¶
EmptyStorageBucket removes the contents of a storage bucket with the given name.
func EmptyStorageBucketE ¶
EmptyStorageBucketE removes the contents of a storage bucket with the given name.
func GetAllGcpRegions ¶
GetAllGcpRegions gets the list of GCP regions available in this account.
func GetAllGcpRegionsE ¶
GetAllGcpRegionsE gets the list of GCP regions available in this account.
func GetAllGcpZones ¶
GetAllGcpZones gets the list of GCP zones available in this account.
func GetAllGcpZonesE ¶
GetAllGcpZonesE gets the list of GCP zones available in this account.
func GetGoogleCredentialsFromEnvVar ¶
func GetGoogleCredentialsFromEnvVar() string
GetGoogleCredentialsFromEnvVar returns the Credentials for use with testing.
func GetGoogleProjectIDFromEnvVar ¶
func GetGoogleProjectIDFromEnvVar() string
GetGoogleProjectIDFromEnvVar returns the Project Id for use with testing.
func GetGoogleRegionFromEnvVar ¶
func GetGoogleRegionFromEnvVar() string
GetGoogleRegionFromEnvVar returns the Region for use with testing.
func GetInstanceIdsForInstanceGroup ¶
func GetInstanceIdsForInstanceGroup(t *testing.T, projectID string, zone string, groupName string) []string
GetInstanceIdsForInstanceGroup gets the IDs of Instances in the given Instance Group.
func GetInstanceIdsForInstanceGroupE ¶
func GetInstanceIdsForInstanceGroupE(t *testing.T, projectID string, zone string, groupName string) ([]string, error)
GetInstanceIdsForInstanceGroupE gets the IDs of Instances in the given Instance Group.
func GetLabelsForComputeInstance ¶
func GetLabelsForComputeInstance(t *testing.T, projectID string, zone string, instanceID string) map[string]string
GetLabelsForComputeInstance returns all the tags for the given Compute Instance.
func GetLabelsForComputeInstanceE ¶
func GetLabelsForComputeInstanceE(t *testing.T, projectID string, zone string, instanceID string) (map[string]string, error)
GetLabelsForComputeInstanceE returns all the tags for the given Compute Instance.
func GetPublicIPOfInstance ¶
GetPublicIPOfInstance gets the public IP address of the given Instance in the given region.
func GetPublicIPOfInstanceE ¶
func GetPublicIPOfInstanceE(t *testing.T, projectID string, zone string, instanceID string) (string, error)
GetPublicIPOfInstanceE gets the public IP address of the given Instance in the given region.
func GetRandomRegion ¶
GetRandomRegion gets a randomly chosen GCP region. If approvedRegions is not empty, this will be a region from the approvedRegions list; otherwise, this method will fetch the latest list of regions from the GCP APIs and pick one of those. If forbiddenRegions is not empty, this method will make sure the returned region is not in the forbiddenRegions list.
func GetRandomRegionE ¶
func GetRandomRegionE(t *testing.T, approvedRegions []string, forbiddenRegions []string) (string, error)
GetRandomRegionE gets a randomly chosen GCP region. If approvedRegions is not empty, this will be a region from the approvedRegions list; otherwise, this method will fetch the latest list of regions from the GCP APIs and pick one of those. If forbiddenRegions is not empty, this method will make sure the returned region is not in the forbiddenRegions list.
func GetRandomZone ¶
GetRandomZone gets a randomly chosen GCP zone. If approvedRegions is not empty, this will be a zone from the approvedZones list; otherwise, this method will fetch the latest list of zones from the GCP APIs and pick one of those. If forbiddenZones is not empty, this method will make sure the returned region is not in the forbiddenZones list.
func GetRandomZoneE ¶
GetRandomZoneE gets a randomly chosen GCP zone. If approvedRegions is not empty, this will be a zone from the approvedZones list; otherwise, this method will fetch the latest list of zones from the GCP APIs and pick one of those. If forbiddenZones is not empty, this method will make sure the returned region is not in the forbiddenZones list.
func NewComputeService ¶
NewComputeService creates a new Compute service.
func NewComputeServiceE ¶
NewComputeServiceE creates a new Compute service.
func ReadBucketObject ¶
ReadBucketObject reads an object from the given Storage Bucket and returns its contents.
func ReadBucketObjectE ¶
ReadBucketObjectE reads an object from the given Storage Bucket and returns its contents.
Types ¶
This section is empty.