gcp

package
v1.116.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Global   = "global"
	Regional = "regional"
	Zonal    = "zonal"
)
View Source
const KCCUserAgent = "kcc/controller-manager"

The user agent to track KCC's attribution to GCP usages

Variables

View Source
var ClientScopes = []string{
	"https://www.googleapis.com/auth/compute",
	"https://www.googleapis.com/auth/cloud-platform",
	"https://www.googleapis.com/auth/cloud-identity",
	"https://www.googleapis.com/auth/ndev.clouddns.readwrite",
	"https://www.googleapis.com/auth/devstorage.full_control",
	"https://www.googleapis.com/auth/userinfo.email",

	"https://www.googleapis.com/auth/drive.readonly",
}

ClientScopes is the list of OAuth2 scopes to be used to create an httpClient. TODO(kcc-eng): configure terraform provider to use this list as the single source of truth

Functions

func FormatBigtableClusterName

func FormatBigtableClusterName(projectID, instanceName, clusterName string) string

func FormatBigtableInstanceName

func FormatBigtableInstanceName(projectID string, name string) string

func FormatComputeNetworkName

func FormatComputeNetworkName(projectID, name string) string

func FormatComputeRouterName

func FormatComputeRouterName(projectID, region, name string) string

func FormatComputeSubNetworkName

func FormatComputeSubNetworkName(projectID, region, name string) string

func FormatFullProjectID

func FormatFullProjectID(projectID string) string

func FormatGlobalComputeSslCertificateName

func FormatGlobalComputeSslCertificateName(projectID, name string) string

func FormatInstanceLocationName

func FormatInstanceLocationName(projectID, name string) string

func FormatPubSubTopicName

func FormatPubSubTopicName(projectID, name string) string

func FormatSQLOperationErrorMessages

func FormatSQLOperationErrorMessages(opErrs []*sqladmin.OperationError) string

func FullResourceNameToShortName

func FullResourceNameToShortName(fullName string) string

func GetDefaultProjectID

func GetDefaultProjectID() (string, error)

GetDefaultProjectID tries to retrieve the default project id through the following:

  1. Grabbing the project id specified in the application-default GCP credentials on the host machine. This often returns an error, for example when the application-default credentials are expired. Also, the default credentials often do not have the project id set (it's set when the credentials are for a service account).
  2. If, in step 1 above, there is an error or the project id field is blank, then silently ignore the failure, and fall back to shelling out to gcloud to get the default project id from the local gcloud config.

func IsLocationRegional

func IsLocationRegional(location string) bool

func IsLocationZonal

func IsLocationZonal(location string) bool

func IsNotAuthorizedError

func IsNotAuthorizedError(err error) bool

func IsNotFoundError

func IsNotFoundError(err error) bool

func LocationToRegion

func LocationToRegion(location string) (string, error)

func NewCloudResourceManagerClient

func NewCloudResourceManagerClient(ctx context.Context) (*cloudresourcemanager.Service, error)

NewCloudResourceManagerClient returns a GCP Cloud Resource Manager service.

func NewIAMClient

func NewIAMClient(ctx context.Context) (*iam.Service, error)

func NewStorageClient

func NewStorageClient(ctx context.Context) (*storage.Service, error)

func WaitForAssetInventoryOperation

func WaitForAssetInventoryOperation(assetClient *cloudasset.Service, operation *cloudasset.Operation, projectNum string,
	interval, timeout time.Duration, callback AssetInventoryWaitCallback) (*cloudasset.Operation, error)

The project number should be the project number for the credentials which are making this request

func WaitForAssetInventoryOperationDefaultTimeout

func WaitForAssetInventoryOperationDefaultTimeout(assetClient *cloudasset.Service,
	operation *cloudasset.Operation, projectNum string, callback AssetInventoryWaitCallback) (*cloudasset.Operation, error)

func WaitForComputeOperation

func WaitForComputeOperation(computeClient *compute.Service, operation *compute.Operation,
	projectID string, interval, timeout time.Duration, callback ComputeWaitCallback) (*compute.Operation, error)

func WaitForComputeOperationDefaultTimeout

func WaitForComputeOperationDefaultTimeout(computeClient *compute.Service, operation *compute.Operation,
	projectID string, callback ComputeWaitCallback) (*compute.Operation, error)

func WaitForResourceManagerOperation

func WaitForResourceManagerOperation(rmClient *resourcemanager.Service, operation *resourcemanager.Operation,
	interval, timeout time.Duration, callback ResourceManagerCallback) (*resourcemanager.Operation, error)

func WaitForResourceManagerOperationDefaultTimeout

func WaitForResourceManagerOperationDefaultTimeout(rmClient *resourcemanager.Service, operation *resourcemanager.Operation,
	callback ResourceManagerCallback) (*resourcemanager.Operation, error)

Types

type AssetInventoryWaitCallback

type AssetInventoryWaitCallback func(operation *cloudasset.Operation) error

type BigtableWaitCallback

type BigtableWaitCallback func(operation *bigtableadmin.Operation) error

type ComputeWaitCallback

type ComputeWaitCallback func(operation *compute.Operation) error

type ContainerWaitCallback

type ContainerWaitCallback func(operation *container.Operation) error

type RedisWaitCallback

type RedisWaitCallback func(operation *redis.Operation) error

type ResourceManagerCallback

type ResourceManagerCallback func(operation *resourcemanager.Operation) error

type SQLWaitCallback added in v1.114.0

type SQLWaitCallback func(operation *sqladmin.Operation) error

type ServiceNetworkingWaitCallback

type ServiceNetworkingWaitCallback func(operation *servicenetworking.Operation) error

type SpannerWaitCallback

type SpannerWaitCallback func(operation *spanner.Operation) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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