gcp

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package gcp allows interaction with Google Cloud Platform resources.

Index

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

func AssertStorageBucketExists(t *testing.T, name string)

AssertStorageBucketExists checks if the given storage bucket exists and fails the test if it does not.

func AssertStorageBucketExistsE

func AssertStorageBucketExistsE(t *testing.T, name string) error

AssertStorageBucketExistsE checks if the given storage bucket exists and returns an error if it does not.

func CreateStorageBucket

func CreateStorageBucket(t *testing.T, projectID string, name string, attr *storage.BucketAttrs)

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

func DeleteImage(t *testing.T, projectID string, imageID string)

DeleteImage deletes the given Compute Image.

func DeleteImageE

func DeleteImageE(t *testing.T, projectID string, imageID string) error

DeleteImageE deletes the given Compute Image.

func DeleteStorageBucket

func DeleteStorageBucket(t *testing.T, name string)

DeleteStorageBucket destroys the Google Storage bucket.

func DeleteStorageBucketE

func DeleteStorageBucketE(t *testing.T, name string) error

DeleteStorageBucketE destroys the S3 bucket in the given region with the given name.

func EmptyStorageBucket

func EmptyStorageBucket(t *testing.T, name string)

EmptyStorageBucket removes the contents of a storage bucket with the given name.

func EmptyStorageBucketE

func EmptyStorageBucketE(t *testing.T, name string) error

EmptyStorageBucketE removes the contents of a storage bucket with the given name.

func GetAllGcpRegions

func GetAllGcpRegions(t *testing.T) []string

GetAllGcpRegions gets the list of GCP regions available in this account.

func GetAllGcpRegionsE

func GetAllGcpRegionsE(t *testing.T) ([]string, error)

GetAllGcpRegionsE gets the list of GCP regions available in this account.

func GetAllGcpZones

func GetAllGcpZones(t *testing.T) []string

GetAllGcpZones gets the list of GCP zones available in this account.

func GetAllGcpZonesE

func GetAllGcpZonesE(t *testing.T) ([]string, error)

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

func GetPublicIPOfInstance(t *testing.T, projectID string, zone string, instanceID string) string

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

func GetRandomRegion(t *testing.T, approvedRegions []string, forbiddenRegions []string) string

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

func GetRandomZone(t *testing.T, approvedZones []string, forbiddenZones []string) string

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

func GetRandomZoneE(t *testing.T, approvedZones []string, forbiddenZones []string) (string, error)

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

func NewComputeService(t *testing.T) *compute.Service

NewComputeService creates a new Compute service.

func NewComputeServiceE

func NewComputeServiceE(t *testing.T) (*compute.Service, error)

NewComputeServiceE creates a new Compute service.

func ReadBucketObject

func ReadBucketObject(t *testing.T, bucketName string, filePath string) io.Reader

ReadBucketObject reads an object from the given Storage Bucket and returns its contents.

func ReadBucketObjectE

func ReadBucketObjectE(t *testing.T, bucketName string, filePath string) (io.Reader, error)

ReadBucketObjectE reads an object from the given Storage Bucket and returns its contents.

func WriteBucketObject

func WriteBucketObject(t *testing.T, bucketName string, filePath string, body io.Reader, contentType string) string

WriteBucketObject writes an object to the given Storage Bucket and returns its URL.

func WriteBucketObjectE

func WriteBucketObjectE(t *testing.T, bucketName string, filePath string, body io.Reader, contentType string) (string, error)

WriteBucketObjectE writes an object to the given Storage Bucket and returns its URL.

Types

This section is empty.

Jump to

Keyboard shortcuts

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