gcp

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidGCSPath              = "gcp.invalid_gcs_path"
	ErrCredentialsFileEnvVarNotSet = "gcp.credentials_file_env_var_not_set"
	ErrProjectIDMismatch           = "gcp.project_id_mismatch"
)

Variables

This section is empty.

Functions

func ConvertGCSObjectsToKeys added in v0.27.0

func ConvertGCSObjectsToKeys(gcsObjects ...*storage.ObjectAttrs) []string

func ErrorCredentialsFileEnvVarNotSet

func ErrorCredentialsFileEnvVarNotSet() error

func ErrorInvalidGCSPath

func ErrorInvalidGCSPath(provided string) error

func ErrorProjectIDMismatch

func ErrorProjectIDMismatch(credsFileProject string, providedProject string, credsFilePath string) error

func GCSPath

func GCSPath(bucket string, key string) string

func IsBucketAlreadyExistsError

func IsBucketAlreadyExistsError(err error) bool

func IsBucketDoesNotExist added in v0.28.0

func IsBucketDoesNotExist(err error) bool

func IsErrCode

func IsErrCode(err error, errorCode int, errorMessage *string) bool

func IsGCPError

func IsGCPError(err error) bool

func IsInvalidBucketNameError

func IsInvalidBucketNameError(err error) bool

func IsValidGCSPath

func IsValidGCSPath(gcsPath string) bool

func NewGoogleAuthProvider

func NewGoogleAuthProvider(addr string, config map[string]string, persister rest.AuthProviderConfigPersister) (rest.AuthProvider, error)

func SplitGCSPath

func SplitGCSPath(gcsPath string) (string, string, error)

func ZoneToRegion

func ZoneToRegion(zone string) string

Types

type Client

type Client struct {
	ProjectID       string
	HashedProjectID string
	ClientEmail     string
	ClientID        string
	PrivateKey      string
	PrivateKeyID    string
	IsAnonymous     bool
	CredentialsJSON []byte
	// contains filtered or unexported fields
}

func NewAnonymousClient added in v0.25.0

func NewAnonymousClient() *Client

func NewFromEnv

func NewFromEnv() (*Client, error)

Uses environment variable $GOOGLE_APPLICATION_CREDENTIALS

func NewFromEnvCheckProjectID

func NewFromEnvCheckProjectID(projectID string) (*Client, error)

Uses environment variable $GOOGLE_APPLICATION_CREDENTIALS

func (*Client) ClusterExists added in v0.25.0

func (c *Client) ClusterExists(clusterName string) (bool, error)

func (*Client) Compute

func (c *Client) Compute() (*compute.Service, error)

func (*Client) CreateBucket

func (c *Client) CreateBucket(bucket string, location string, ignoreErrorIfBucketExists bool) error

func (*Client) CreateCluster

func (*Client) CreateK8SConfigFromCluster

func (c *Client) CreateK8SConfigFromCluster(cluster *containerpb.Cluster) (*rest.Config, error)

func (*Client) DeleteBucket

func (c *Client) DeleteBucket(bucket string) error

func (*Client) DeleteCluster

func (c *Client) DeleteCluster(clusterName string) (*containerpb.Operation, error)

func (*Client) DeleteGCSDir

func (c *Client) DeleteGCSDir(bucket string, gcsDir string, continueIfFailure bool) error

func (*Client) DeleteGCSFile

func (c *Client) DeleteGCSFile(bucket string, key string) error

func (*Client) DeleteGCSPrefix

func (c *Client) DeleteGCSPrefix(bucket string, gcsDir string, continueIfFailure bool) error

func (*Client) DoesBucketExist added in v0.28.0

func (c *Client) DoesBucketExist(bucket string) (bool, error)

func (*Client) GCS

func (c *Client) GCS() (*storage.Client, error)

func (*Client) GKE

func (*Client) GetAvailableAcceleratorTypes

func (c *Client) GetAvailableAcceleratorTypes(zone string) ([]string, error)

func (*Client) GetAvailableAcceleratorTypesForAllZones

func (c *Client) GetAvailableAcceleratorTypesForAllZones() ([]string, error)

func (*Client) GetAvailableInstanceTypes

func (c *Client) GetAvailableInstanceTypes(zone string) ([]string, error)

func (*Client) GetAvailableInstanceTypesForAllZones

func (c *Client) GetAvailableInstanceTypesForAllZones() ([]string, error)

func (*Client) GetAvailableZones

func (c *Client) GetAvailableZones() ([]string, error)

func (*Client) GetAvailableZonesForAccelerator

func (c *Client) GetAvailableZonesForAccelerator(acceleratorType string) ([]string, error)

func (*Client) GetCluster

func (c *Client) GetCluster(clusterName string) (*containerpb.Cluster, error)

func (*Client) GetInstanceTypesMetadata

func (c *Client) GetInstanceTypesMetadata(zone string) ([]compute.MachineType, error)

func (*Client) GetInstanceTypesMetadataForAllZones

func (c *Client) GetInstanceTypesMetadataForAllZones() ([]compute.MachineType, error)

func (*Client) GetInstanceTypesWithPrefix

func (c *Client) GetInstanceTypesWithPrefix(prefix string, zone string) ([]string, error)

func (*Client) IsAcceleratorTypeAvailable

func (c *Client) IsAcceleratorTypeAvailable(acceleratorType string, zone string) (bool, error)

func (*Client) IsGCSFile

func (c *Client) IsGCSFile(bucket string, key string) (bool, error)

func (*Client) IsInstanceTypeAvailable

func (c *Client) IsInstanceTypeAvailable(instanceType string, zone string) (bool, error)

func (*Client) IsProjectIDValid

func (c *Client) IsProjectIDValid() (bool, error)

func (*Client) IsZoneValid

func (c *Client) IsZoneValid(zone string) (bool, error)

func (*Client) ListGCSDir

func (c *Client) ListGCSDir(bucket string, gcsDir string, includeDirObjects bool, maxResults *int64) ([]*storage.ObjectAttrs, error)

func (*Client) ListGCSDirOneLevel

func (c *Client) ListGCSDirOneLevel(bucket string, gcsDir string, maxResults *int64) ([]string, error)

This behaves like you'd expect `ls` to behave on a local file system "directory" names will be returned even if S3 directory objects don't exist

func (*Client) ListGCSPathDir

func (c *Client) ListGCSPathDir(gcsDirPath string, includeDirObjects bool, maxResults *int64) ([]*storage.ObjectAttrs, error)

func (*Client) ListGCSPrefix added in v0.27.0

func (c *Client) ListGCSPrefix(bucket string, prefix string, includeDirObjects bool, maxResults *int64) ([]*storage.ObjectAttrs, error)

func (*Client) ReadBytesFromGCS

func (c *Client) ReadBytesFromGCS(bucket string, key string) ([]byte, error)

func (*Client) ReadJSONFromGCS

func (c *Client) ReadJSONFromGCS(objPtr interface{}, bucket string, key string) error

func (*Client) UploadBytesToGCS

func (c *Client) UploadBytesToGCS(data []byte, bucket string, key string) error

func (*Client) UploadJSONToGCS

func (c *Client) UploadJSONToGCS(obj interface{}, bucket string, key string) error

func (*Client) UploadStringToGCS added in v0.27.0

func (c *Client) UploadStringToGCS(str string, bucket string, key string) error

Jump to

Keyboard shortcuts

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