client

package
v0.1.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	NetworkTierPremium  networkTier = "PREMIUM"
	NetworkTierStandard networkTier = "STANDARD"
)
View Source
const (
	IpVersionIpV4 ipVersion = "IPV4"
	IpVersionIpV6 ipVersion = "IPV6"
)
View Source
const (
	AddressTypeExternal addressType = "EXTERNAL"
	AddressTypeInternal addressType = "INTERNAL"
)
View Source
const (
	IpRangePurposeVPCPeering            ipRangePurpose = "VPC_PEERING"
	IpRangePurposePrivateServiceConnect ipRangePurpose = "PRIVATE_SERVICE_CONNECT"
)
View Source
const (
	Ipv6EndpointTypeVm    ipv6EndpointType = "VM"
	Ipv6EndpointTypeNetlb ipv6EndpointType = "NETLB"
)
View Source
const (
	//Common States
	Deleted v1beta1.StatusState = "Deleted"

	//IPRange States
	SyncAddress         v1beta1.StatusState = "SyncAddress"
	SyncPsaConnection   v1beta1.StatusState = "SyncPSAConnection"
	DeletePsaConnection v1beta1.StatusState = "DeletePSAConnection"
	DeleteAddress       v1beta1.StatusState = "DeleteAddress"

	//Filestore States
	SyncFilestore   v1beta1.StatusState = "SyncFilestore"
	DeleteFilestore v1beta1.StatusState = "DeleteFilestore"
)
View Source
const GcpOperationWaitTime = time.Second * 5
View Source
const GcpRetryWaitTime = time.Second * 3
View Source
const PsaPeeringName = "servicenetworking-googleapis-com"
View Source
const ServiceNetworkingServiceConnectionName = "services/servicenetworking.googleapis.com/connections/servicenetworking-googleapis-com"
View Source
const ServiceNetworkingServicePath = "services/servicenetworking.googleapis.com"

Variables

View Source
var FilestoreInstanceRegEx *regexp.Regexp = regexp.MustCompile(`^projects\/([^/]+)\/locations\/([^/]+)\/instances\/([^/]+)$`)

Functions

func GetCachedGcpClient

func GetCachedGcpClient(ctx context.Context, saJsonKeyPath string) (*http.Client, error)

func GetCachedProjectNumber

func GetCachedProjectNumber(projectId string, crmService *cloudresourcemanager.Service) (int64, error)

GetCachedProjectNumber get project number from cloud resources manager for a given project id

func GetCompleteServiceName added in v0.1.4

func GetCompleteServiceName(projectId string, serviceName GcpServiceName) string

func GetConfigDuration added in v0.1.4

func GetConfigDuration(env abstractions.Environment, key string, defaultValue time.Duration) time.Duration

func GetFilestoreInstancePath

func GetFilestoreInstancePath(projectId, location, instanceId string) string

func GetFilestoreParentPath

func GetFilestoreParentPath(projectId, location string) string

func GetNetworkFilter

func GetNetworkFilter(projectId, vpcId string) string

func GetVPCPath

func GetVPCPath(projectId, vpcId string) string

Types

type ClientProvider

type ClientProvider[T any] func(ctx context.Context, saJsonKeyPath string) (T, error)

func NewCachedClientProvider

func NewCachedClientProvider[T comparable](p ClientProvider[T]) ClientProvider[T]

func NewServiceUsageClientProvider added in v0.1.4

func NewServiceUsageClientProvider() ClientProvider[ServiceUsageClient]

type FilestoreState

type FilestoreState string
const (
	CREATING   FilestoreState = "CREATING"
	READY      FilestoreState = "READY"
	REPAIRING  FilestoreState = "REPAIRING"
	DELETING   FilestoreState = "DELETING"
	ERROR      FilestoreState = "ERROR"
	RESTORING  FilestoreState = "RESTORING"
	SUSPENDED  FilestoreState = "SUSPENDED"
	SUSPENDING FilestoreState = "SUSPENDING"
	RESUMING   FilestoreState = "RESUMING"
	REVERTING  FilestoreState = "REVERTING"
)

type GcpConfig added in v0.1.4

type GcpConfig struct {
	GcpRetryWaitTime     time.Duration
	GcpOperationWaitTime time.Duration
}

func GetGcpConfig added in v0.1.4

func GetGcpConfig(env abstractions.Environment) *GcpConfig

type GcpServiceName added in v0.1.4

type GcpServiceName string
const (
	ServiceNetworkingService    GcpServiceName = "servicenetworking.googleapis.com"
	ComputeService              GcpServiceName = "compute.googleapis.com"
	FilestoreService            GcpServiceName = "file.googleapis.com"
	CloudResourceManagerService GcpServiceName = "cloudresourcemanager.googleapis.com"
)

type OperationType

type OperationType int
const (
	NONE OperationType = iota
	ADD
	MODIFY
	DELETE
)

type ServiceUsageClient added in v0.1.4

type ServiceUsageClient interface {
	EnableService(ctx context.Context, projectId string, serviceName GcpServiceName) (*serviceusage.Operation, error)
	DisableService(ctx context.Context, projectId string, serviceName GcpServiceName) (*serviceusage.Operation, error)
	IsServiceEnabled(ctx context.Context, projectId string, serviceName GcpServiceName) (bool, error)
	GetServiceUsageOperation(ctx context.Context, operationName string) (*serviceusage.Operation, error)
}

func NewServiceUsageClient added in v0.1.4

func NewServiceUsageClient(svcServiceUsage *serviceusage.Service) ServiceUsageClient

Jump to

Keyboard shortcuts

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