client

package
v1.29.4 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IgnoreErrorCodes added in v1.24.0

func IgnoreErrorCodes(err error, codes ...int) error

IgnoreErrorCodes returns nil if the error matches one of the provided HTTP status codes.

func IgnoreNotFoundError added in v1.27.0

func IgnoreNotFoundError(err error) error

IgnoreNotFoundError returns nil if the error is a NotFound error. Otherwise, it returns the original error.

func IsErrorCode added in v1.24.0

func IsErrorCode(err error, codes ...int) bool

IsErrorCode checks if the error is of type googleapi.Error and the HTTP status matches one of the provided list of codes.

Types

type ComputeClient added in v1.19.0

type ComputeClient interface {
	// GetExternalAddresses returns a list of all external IP addresses mapped to the names of their users.
	GetExternalAddresses(ctx context.Context, region string) (map[string][]string, error)
	// GetVPC returns a name of VPC
	GetVPC(ctx context.Context, network string) (*compute.Network, error)
	// GetSubnet returns a subnet info.
	GetSubnet(ctx context.Context, region, subnet string) (*compute.Subnetwork, error)
}

ComputeClient is an interface which must be implemented by GCP compute clients.

func NewComputeClientFromSecretRef added in v1.19.0

func NewComputeClientFromSecretRef(ctx context.Context, c client.Client, secretRef corev1.SecretReference) (ComputeClient, error)

NewComputeClientFromSecretRef creates a new compute client from the given client and secret reference.

type DNSClient added in v1.18.0

type DNSClient interface {
	GetManagedZones(ctx context.Context) (map[string]string, error)
	CreateOrUpdateRecordSet(ctx context.Context, managedZone, name, recordType string, rrdatas []string, ttl int64) error
	DeleteRecordSet(ctx context.Context, managedZone, name, recordType string) error
}

DNSClient is an interface which must be implemented by GCP DNS clients.

func NewDNSClientFromSecretRef added in v1.18.0

func NewDNSClientFromSecretRef(ctx context.Context, c client.Client, secretRef corev1.SecretReference) (DNSClient, error)

NewDNSClientFromSecretRef creates a new DNS client from the given client and secret reference.

type Factory added in v1.18.0

Factory is a factory that can produce clients for various GCP Services.

func NewFactory added in v1.18.0

func NewFactory() Factory

NewFactory returns a new factory to produce clients for various GCP services.

type IAMClient added in v1.24.0

type IAMClient interface {
	GetServiceAccount(ctx context.Context, name string) (*iam.ServiceAccount, error)
}

IAMClient is the client interface for the IAM API.

func NewIAMClient added in v1.24.0

func NewIAMClient(ctx context.Context, serviceAccount *gcp.ServiceAccount) (IAMClient, error)

NewIAMClient returns a new IAM client.

func NewIAMClientFromSecretRef added in v1.24.0

func NewIAMClientFromSecretRef(ctx context.Context, c client.Client, secretRef corev1.SecretReference) (IAMClient, error)

NewIAMClientFromSecretRef creates a new compute client from the given client and secret reference.

type StorageClient

type StorageClient interface {
	// GCS wrappers
	CreateBucketIfNotExists(ctx context.Context, bucketName, region string) error
	DeleteBucketIfExists(ctx context.Context, bucketName string) error
	DeleteObjectsWithPrefix(ctx context.Context, bucketName, prefix string) error
}

StorageClient is an interface which must be implemented by GCS clients.

func NewStorageClient

func NewStorageClient(ctx context.Context, serviceAccount *gcp.ServiceAccount) (StorageClient, error)

NewStorageClient creates a new storage client from the given serviceAccount.

func NewStorageClientFromSecretRef

func NewStorageClientFromSecretRef(ctx context.Context, c client.Client, secretRef corev1.SecretReference) (StorageClient, error)

NewStorageClientFromSecretRef creates a new storage client from the given <secretRef>.

Directories

Path Synopsis
Package client is a generated GoMock package.
Package client is a generated GoMock package.

Jump to

Keyboard shortcuts

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