gcloud

package
v0.0.0-...-e601d7c Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceTypeArtifactRegistry      = "gcp-artifact-registry"
	ResourceTypeRemoteDockerImagePush = "gcp-docker-image-push"
)
View Source
const (
	AuthTypeGCPServiceAccount    = "gcp-service-account"
	SecretsTypeGCPSecretsManager = "gcp-secrets-manager"

	StateStorageTypeGcpBucket = "gcp-bucket"
	SecretsProviderTypeGcpKms = "gcp-kms"
)
View Source
const (
	ResourceTypeGkeAutopilot = "gcp-gke-autopilot-cluster"
	TemplateTypeGkeAutopilot = "gcp-gke-autopilot"
)
View Source
const ProviderType = "gcp"
View Source
const ResourceTypeBucket = "gcp-bucket"
View Source
const ResourceTypePostgresGcpCloudsql = "gcp-cloudsql-postgres"
View Source
const ResourceTypePubSub = "gcp-pubsub"
View Source
const ResourceTypeRedis = "gcp-redis"
View Source
const (
	TemplateTypeGcpCloudrun = "cloudrun"
)
View Source
const TemplateTypeStaticWebsite = "gcp-static-website"

Variables

This section is empty.

Functions

func ArtifactRegistryConfigReadConfig

func ArtifactRegistryConfigReadConfig(config *api.Config) (api.Config, error)

func DockerRemoteImagePushReadConfig

func DockerRemoteImagePushReadConfig(config *api.Config) (api.Config, error)

func GcpBucketReadConfig

func GcpBucketReadConfig(config *api.Config) (api.Config, error)

func GcpPubSubTopicsReadConfig

func GcpPubSubTopicsReadConfig(config *api.Config) (api.Config, error)

func PostgresqlGcpCloudsqlReadConfig

func PostgresqlGcpCloudsqlReadConfig(config *api.Config) (api.Config, error)

func ReadAuthServiceAccountConfig

func ReadAuthServiceAccountConfig(config *api.Config) (api.Config, error)

func ReadGkeAutopilotResourceConfig

func ReadGkeAutopilotResourceConfig(config *api.Config) (api.Config, error)

func ReadGkeAutopilotTemplateConfig

func ReadGkeAutopilotTemplateConfig(config *api.Config) (api.Config, error)

func ReadSecretsProviderConfig

func ReadSecretsProviderConfig(config *api.Config) (api.Config, error)

func ReadStateStorageConfig

func ReadStateStorageConfig(config *api.Config) (api.Config, error)

func ReadTemplateConfig

func ReadTemplateConfig(config *api.Config) (api.Config, error)

func RedisReadConfig

func RedisReadConfig(config *api.Config) (api.Config, error)

func ToCloudRunConfig

func ToCloudRunConfig(tpl any, composeCfg compose.Config, stackCfg *api.StackConfigCompose) (any, error)

func ToGkeAutopilotConfig

func ToGkeAutopilotConfig(tpl any, composeCfg compose.Config, stackCfg *api.StackConfigCompose) (any, error)

func ToStaticSiteConfig

func ToStaticSiteConfig(tpl any, stackDir, stackName string, stackCfg *api.StackConfigStatic) (any, error)

Types

type AlertsConfig

type AlertsConfig struct {
	MaxErrors MaxErrorConfig
	Discord   DiscordCfg
	Telegram  TelegramCfg
}

type ArtifactRegistryConfig

type ArtifactRegistryConfig struct {
	Credentials `json:",inline" yaml:",inline"`
	Location    string             `json:"location" yaml:"location"`
	Public      *bool              `json:"public,omitempty" yaml:"public,omitempty"`
	Docker      *DockerConfig      `json:"docker,omitempty" yaml:"docker,omitempty"`
	Domain      *string            `json:"domain" yaml:"domain"`
	BasicAuth   *RegistryBasicAuth `json:"basicAuth,omitempty" yaml:"basicAuth,omitempty"`
}

type CloudRunInput

type CloudRunInput struct {
	TemplateConfig `json:"templateConfig" yaml:"templateConfig"`
	Deployment     k8s.DeploymentConfig `json:"deployment" yaml:"deployment"`
}

func (*CloudRunInput) OverriddenBaseZone

func (i *CloudRunInput) OverriddenBaseZone() string

func (*CloudRunInput) Uses

func (i *CloudRunInput) Uses() []string

type Credentials

type Credentials struct {
	api.Credentials      `json:",inline" yaml:",inline"`
	ServiceAccountConfig `json:",inline" yaml:",inline"`
}

func (*Credentials) CredentialsParsed

func (r *Credentials) CredentialsParsed() (*CredentialsParsed, error)

func (*Credentials) CredentialsValue

func (r *Credentials) CredentialsValue() string

func (*Credentials) ProjectIdValue

func (r *Credentials) ProjectIdValue() string

func (*Credentials) ProviderType

func (r *Credentials) ProviderType() string

type CredentialsParsed

type CredentialsParsed struct {
	Type        string `json:"type"`
	ClientEmail string `json:"client_email"`
}

type DiscordCfg

type DiscordCfg struct {
	WebhookId string
}

type DockerConfig

type DockerConfig struct {
	ImmutableTags *bool `json:"immutableTags" yaml:"immutableTags"`
}

type ExternalEgressIpConfig

type ExternalEgressIpConfig struct {
	Enabled  bool   `json:"enabled" yaml:"enabled"`
	Existing string `json:"existing,omitempty" yaml:"existing,omitempty"`
}

ExternalEgressIpConfig provides simple configuration for static egress IP

func (*ExternalEgressIpConfig) Validate

func (c *ExternalEgressIpConfig) Validate() error

Validate validates the ExternalEgressIpConfig

type GcpBucket

type GcpBucket struct {
	Credentials `json:",inline" yaml:",inline"`
	Name        string `json:"name,omitempty" yaml:"name"`
	Location    string `json:"location" yaml:"location"`
	// Resource adoption fields
	Adopt      bool   `json:"adopt,omitempty" yaml:"adopt,omitempty"`
	BucketName string `json:"bucketName,omitempty" yaml:"bucketName,omitempty"`
}

func (*GcpBucket) GetBucketName

func (b *GcpBucket) GetBucketName() string

GetBucketName returns the bucket name, supporting both "name" and "bucketName" fields Falls back to "name" if "bucketName" is empty, or "bucketName" if "name" is empty

type GkeAutopilotInput

type GkeAutopilotInput struct {
	GkeAutopilotTemplate `json:"templateConfig" yaml:"templateConfig"`
	Deployment           k8s.DeploymentConfig `json:"deployment" yaml:"deployment"`
}

func (*GkeAutopilotInput) DependsOnResources

func (i *GkeAutopilotInput) DependsOnResources() []api.StackConfigDependencyResource

func (*GkeAutopilotInput) OverriddenBaseZone

func (i *GkeAutopilotInput) OverriddenBaseZone() string

func (*GkeAutopilotInput) Uses

func (i *GkeAutopilotInput) Uses() []string

type GkeAutopilotResource

type GkeAutopilotResource struct {
	Credentials   `json:",inline" yaml:",inline"`
	GkeMinVersion string           `json:"gkeMinVersion" yaml:"gkeMinVersion"`
	Location      string           `json:"location" yaml:"location"`
	Zone          string           `json:"zone" yaml:"zone"`
	Timeouts      *Timeouts        `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
	Caddy         *k8s.CaddyConfig `json:"caddy,omitempty" yaml:"caddy,omitempty"`

	// External Egress IP Configuration
	ExternalEgressIp *ExternalEgressIpConfig `json:"externalEgressIp,omitempty" yaml:"externalEgressIp,omitempty"`

	// Private VPC - creates dedicated VPC for the cluster (avoids CloudNAT conflicts)
	PrivateVpc bool `json:"privateVpc,omitempty" yaml:"privateVpc,omitempty"`

	// Resource adoption fields
	Adopt       bool   `json:"adopt,omitempty" yaml:"adopt,omitempty"`
	ClusterName string `json:"clusterName,omitempty" yaml:"clusterName,omitempty"`
}

type GkeAutopilotTemplate

type GkeAutopilotTemplate struct {
	Credentials              `json:",inline" yaml:",inline"`
	GkeClusterResource       string `json:"gkeClusterResource" yaml:"gkeClusterResource"`
	ArtifactRegistryResource string `json:"artifactRegistryResource" yaml:"artifactRegistryResource"`
}

type MaxErrorConfig

type MaxErrorConfig struct {
	ErrorLogMessageRegexp string
	MaxErrorCount         int
}

type PlainLabels

type PlainLabels map[string]string

type PostgresGcpCloudsqlConfig

type PostgresGcpCloudsqlConfig struct {
	Credentials           `json:",inline" yaml:",inline"`
	Version               string                  `json:"version" yaml:"version"`
	Project               string                  `json:"project" yaml:"project"`
	Tier                  *string                 `json:"tier" yaml:"tier"`
	Region                *string                 `json:"region" yaml:"region"`
	MaxConnections        *int                    `json:"maxConnections" yaml:"maxConnections"`
	DeletionProtection    *bool                   `json:"deletionProtection" yaml:"deletionProtection"`
	QueryInsightsEnabled  *bool                   `json:"queryInsightsEnabled" yaml:"queryInsightsEnabled"`
	QueryStringLength     *int                    `json:"queryStringLength" yaml:"queryStringLength"`
	UsersProvisionRuntime *ProvisionRuntimeConfig `json:"usersProvisionRuntime" yaml:"usersProvisionRuntime"`
	// Backup configuration
	BackupEnabled               *bool   `json:"backupEnabled,omitempty" yaml:"backupEnabled,omitempty"`
	BackupStartTime             *string `json:"backupStartTime,omitempty" yaml:"backupStartTime,omitempty"`
	PointInTimeRecoveryEnabled  *bool   `json:"pointInTimeRecoveryEnabled,omitempty" yaml:"pointInTimeRecoveryEnabled,omitempty"`
	TransactionLogRetentionDays *int    `json:"transactionLogRetentionDays,omitempty" yaml:"transactionLogRetentionDays,omitempty"`
	RetainedBackups             *int    `json:"retainedBackups,omitempty" yaml:"retainedBackups,omitempty"`
	// High availability
	AvailabilityType *string `json:"availabilityType,omitempty" yaml:"availabilityType,omitempty"` // ZONAL or REGIONAL
	// SSL
	RequireSsl *bool `json:"requireSsl,omitempty" yaml:"requireSsl,omitempty"`
	// Resource adoption fields
	Adopt          bool   `json:"adopt,omitempty" yaml:"adopt,omitempty"`
	InstanceName   string `json:"instanceName,omitempty" yaml:"instanceName,omitempty"`
	ConnectionName string `json:"connectionName,omitempty" yaml:"connectionName,omitempty"`
	RootPassword   string `json:"rootPassword,omitempty" yaml:"rootPassword,omitempty"`
}

type ProvisionRuntimeConfig

type ProvisionRuntimeConfig struct {
	Type         string `json:"type" yaml:"type"`                 // type of provisioning runtime
	ResourceName string `json:"resourceName" yaml:"resourceName"` // allows to run init db users jobs on kube jobs (must reference resource name where we can obtain kubeconfig from, e.g. gke-autopilot-cluster)
}

type PubSubConfig

type PubSubConfig struct {
	Credentials   `json:",inline" yaml:",inline"`
	Topics        []PubSubTopic        `json:"topics" yaml:"topics"`
	Subscriptions []PubSubSubscription `json:"subscriptions" yaml:"subscriptions"`
	Labels        PlainLabels          `json:"labels" yaml:"labels"`
}

type PubSubSubscription

type PubSubSubscription struct {
	Name                     string                            `json:"name" yaml:"name"`
	Topic                    string                            `json:"topic" yaml:"topic"`
	Labels                   PlainLabels                       `json:"labels" yaml:"labels"`
	DeadLetterPolicy         *SubscriptionDeadLetterPolicyArgs `json:"deadLetterPolicy" yaml:"deadLetterPolicy"`
	ExactlyOnceDelivery      bool                              `json:"exactlyOnceDelivery" yaml:"exactlyOnceDelivery"`
	AckDeadlineSec           int                               `json:"ackDeadlineSec" yaml:"ackDeadlineSec"`
	MessageRetentionDuration string                            `json:"messageRetentionDuration" yaml:"messageRetentionDuration"`
}

type PubSubTopic

type PubSubTopic struct {
	Name                     string      `json:"name" yaml:"name"`
	Labels                   PlainLabels `json:"labels" yaml:"labels"`
	MessageRetentionDuration string      `json:"messageRetentionDuration" yaml:"messageRetentionDuration"`
}

type RedisConfig

type RedisConfig struct {
	Credentials  `json:",inline" yaml:",inline"`
	Version      string            `json:"version" yaml:"version"`
	Project      string            `json:"project" yaml:"project"`
	MemorySizeGb int               `json:"memorySizeGb" yaml:"memorySizeGb"`
	RedisConfig  map[string]string `json:"redisConfig" yaml:"redisConfig"`
	Region       *string           `json:"region" yaml:"region"`

	// VPC Network Configuration
	AuthorizedNetwork *string `json:"authorizedNetwork,omitempty" yaml:"authorizedNetwork,omitempty"` // VPC network for Redis connectivity

	// Resource adoption fields
	Adopt      bool   `json:"adopt,omitempty" yaml:"adopt,omitempty"`
	InstanceId string `json:"instanceId,omitempty" yaml:"instanceId,omitempty"`
}

type RegistryBasicAuth

type RegistryBasicAuth struct {
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

type RemoteImagePush

type RemoteImagePush struct {
	Credentials              `json:",inline" yaml:",inline"`
	RemoteImage              string            `json:"remoteImage" yaml:"remoteImage"`
	Name                     string            `json:"name" yaml:"name"`
	Tag                      string            `json:"tag" yaml:"tag"`
	ArtifactRegistryResource string            `json:"artifactRegistryResource" yaml:"artifactRegistryResource"`
	RegistryCredentials      *string           `json:"registryCredentials" yaml:"registryCredentials"` // TODO: support other registries' creds
	Platform                 api.ImagePlatform `json:"platform" yaml:"platform"`
}

func (*RemoteImagePush) DependsOnResources

func (i *RemoteImagePush) DependsOnResources() []api.ParentResourceDependency

type SecretsProviderConfig

type SecretsProviderConfig struct {
	Credentials `json:",inline" yaml:",inline"`
	// format:
	// "gcpkms://projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s"
	KeyName string `json:"keyName" yaml:"keyName"`

	// only applicable when provision=true
	KeyLocation string `json:"keyLocation" yaml:"keyLocation"`
	// only applicable when provision=true
	KeyRotationPeriod string `json:"keyRotationPeriod" yaml:"keyRotationPeriod"`

	// whether to provision key
	Provision bool `json:"provision" yaml:"provision"`
}

func (*SecretsProviderConfig) IsProvisionEnabled

func (r *SecretsProviderConfig) IsProvisionEnabled() bool

func (*SecretsProviderConfig) KeyUrl

func (r *SecretsProviderConfig) KeyUrl() string

type ServiceAccountConfig

type ServiceAccountConfig struct {
	ProjectId string `json:"projectId" yaml:"projectId"`
}

type StateStorageConfig

type StateStorageConfig struct {
	Credentials `json:",inline" yaml:",inline"`
	BucketName  string  `json:"bucketName" yaml:"bucketName"`
	Name        string  `json:"name,omitempty" yaml:"name,omitempty"`
	Location    *string `json:"location" yaml:"location"`
	Provision   bool    `json:"provision" yaml:"provision"`
}

func (*StateStorageConfig) GetBucketName

func (s *StateStorageConfig) GetBucketName() string

GetBucketName returns the bucket name, supporting both "name" and "bucketName" fields Falls back to "name" if "bucketName" is empty, or "bucketName" if "name" is empty

func (*StateStorageConfig) IsProvisionEnabled

func (sa *StateStorageConfig) IsProvisionEnabled() bool

func (*StateStorageConfig) StorageUrl

func (sa *StateStorageConfig) StorageUrl() string

type StaticSiteInput

type StaticSiteInput struct {
	TemplateConfig         `json:"templateConfig" yaml:"templateConfig"`
	*api.StackConfigStatic `json:",inline" yaml:",inline"`
	StackDir               string `json:"stackDir" yaml:"stackDir"`
	StackName              string `json:"stackName" yaml:"stackName"`
	Location               string `json:"location" yaml:"location"`
	BaseDnsZone            string `json:"baseDnsZone" yaml:"baseDnsZone"`
}

func (*StaticSiteInput) OverriddenBaseZone

func (i *StaticSiteInput) OverriddenBaseZone() string

type SubscriptionDeadLetterPolicyArgs

type SubscriptionDeadLetterPolicyArgs struct {
	DeadLetterTopic     *string `json:"deadLetterTopic,omitempty" yaml:"deadLetterTopic,omitempty"`
	MaxDeliveryAttempts *int    `json:"maxDeliveryAttempts,omitempty" yaml:"maxDeliveryAttempts,omitempty"`
}

type TelegramCfg

type TelegramCfg struct {
	DefaultChatId string
}

type TemplateConfig

type TemplateConfig struct {
	Credentials `json:",inline" yaml:",inline"`
}

type Timeouts

type Timeouts struct {
	Create string `json:"create" yaml:"create"`
	Update string `json:"update" yaml:"update"`
	Delete string `json:"delete" yaml:"delete"`
}

Jump to

Keyboard shortcuts

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