drivers

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package drivers contains ResourceDriver implementations for each DigitalOcean resource type.

Index

Constants

This section is empty.

Variables

View Source
var ErrResourceNotFound = errors.New("resource not found")

ErrResourceNotFound is returned when a resource cannot be located by name or ID. It is intended to be used with errors.Is for sentinel matching.

Functions

func ParseImageRef added in v0.5.1

func ParseImageRef(imageStr string) (*godo.ImageSourceSpec, error)

ParseImageRef parses a flat image reference string into a DO App Platform ImageSourceSpec. Supports:

  • registry.digitalocean.com/<registry>/<repo>:<tag> → DOCR (Registry left empty per DO API requirement)
  • ghcr.io/<org>/<repo>:<tag> → GHCR
  • docker.io/<org>/<repo>:<tag> → DOCKER_HUB
  • <org>/<repo>:<tag> → DOCKER_HUB (bare form)

A missing tag defaults to "latest".

func WrapGodoError added in v0.6.1

func WrapGodoError(err error) error

WrapGodoError inspects err for a *godo.ErrorResponse and maps its HTTP status code to the matching interfaces.Err* sentinel. The returned error wraps the sentinel so callers can use errors.Is for classification while still having access to the original DO API message via err.Error().

Two passthrough branches return err unchanged:

  • err is nil → return nil (no-op; safe to call unconditionally)
  • err is not a *godo.ErrorResponse, or its Response field is nil → return err (e.g. network errors, context cancellation, or SDK bugs; not DO API errors)

HTTP codes with no sentinel mapping (e.g. 301, 400 handled elsewhere) also pass through unchanged via sentinelForStatus returning nil.

Types

type APIGatewayAppClient added in v0.1.1

type APIGatewayAppClient interface {
	Create(ctx context.Context, req *godo.AppCreateRequest) (*godo.App, *godo.Response, error)
	Get(ctx context.Context, appID string) (*godo.App, *godo.Response, error)
	Update(ctx context.Context, appID string, req *godo.AppUpdateRequest) (*godo.App, *godo.Response, error)
	Delete(ctx context.Context, appID string) (*godo.Response, error)
}

APIGatewayAppClient is the godo App interface used for API gateway management (for mocking).

type APIGatewayDriver added in v0.1.1

type APIGatewayDriver struct {
	// contains filtered or unexported fields
}

APIGatewayDriver manages API routing via DigitalOcean App Platform (infra.api_gateway). It creates an App Platform application with HTTP route rules mapping paths to backend services.

Config keys:

region  string            — DO region slug (default: driver region)
routes  []map[string]any  — each: {path, component, preserve_path_prefix}
                            component maps to an App Platform service component name

func NewAPIGatewayDriver added in v0.1.1

func NewAPIGatewayDriver(c *godo.Client, region string) *APIGatewayDriver

NewAPIGatewayDriver creates an APIGatewayDriver backed by a real godo client.

func NewAPIGatewayDriverWithClient added in v0.1.1

func NewAPIGatewayDriverWithClient(c APIGatewayAppClient, region string) *APIGatewayDriver

NewAPIGatewayDriverWithClient creates a driver with an injected client (for tests).

func (*APIGatewayDriver) Create added in v0.1.1

func (*APIGatewayDriver) Delete added in v0.1.1

func (*APIGatewayDriver) Diff added in v0.1.1

func (*APIGatewayDriver) HealthCheck added in v0.1.1

func (*APIGatewayDriver) Read added in v0.1.1

func (*APIGatewayDriver) Scale added in v0.1.1

func (*APIGatewayDriver) SensitiveKeys added in v0.2.1

func (d *APIGatewayDriver) SensitiveKeys() []string

func (*APIGatewayDriver) Update added in v0.1.1

type AppBlueGreenDriver added in v0.2.0

type AppBlueGreenDriver struct {
	// contains filtered or unexported fields
}

AppBlueGreenDriver implements module.BlueGreenDriver for DigitalOcean App Platform.

Blue environment: the existing app identified by blueID. Green environment: a new app created with the "-green" name suffix.

SwitchTraffic is implemented by updating the blue app's spec with the green image (making blue the new stable), then DestroyBlue removes the green clone. The green app's live URL is returned from GreenEndpoint.

func NewAppBlueGreenDriver added in v0.2.0

func NewAppBlueGreenDriver(c AppPlatformClient, region, blueID, blueName string) *AppBlueGreenDriver

NewAppBlueGreenDriver creates a BlueGreenDriver for DO App Platform.

func (*AppBlueGreenDriver) CreateGreen added in v0.2.0

func (d *AppBlueGreenDriver) CreateGreen(ctx context.Context, image string) error

CreateGreen creates a new App Platform app with the "-green" name suffix and the given image, recording the green app ID and live URL for later use.

func (*AppBlueGreenDriver) CurrentImage added in v0.2.0

func (d *AppBlueGreenDriver) CurrentImage(ctx context.Context) (string, error)

func (*AppBlueGreenDriver) DestroyBlue added in v0.2.0

func (d *AppBlueGreenDriver) DestroyBlue(ctx context.Context) error

DestroyBlue deletes the green clone (the temporary environment).

func (*AppBlueGreenDriver) GreenEndpoint added in v0.2.0

func (d *AppBlueGreenDriver) GreenEndpoint(_ context.Context) (string, error)

GreenEndpoint returns the live URL of the green App Platform app.

func (*AppBlueGreenDriver) HealthCheck added in v0.2.0

func (d *AppBlueGreenDriver) HealthCheck(ctx context.Context, path string) error

func (*AppBlueGreenDriver) ReplicaCount added in v0.2.0

func (d *AppBlueGreenDriver) ReplicaCount(ctx context.Context) (int, error)

func (*AppBlueGreenDriver) SwitchTraffic added in v0.2.0

func (d *AppBlueGreenDriver) SwitchTraffic(ctx context.Context) error

SwitchTraffic updates the blue app spec to use the green image, effectively promoting the green version as the stable app. DO App Platform does not support weighted traffic splitting natively; this performs a full cutover.

func (*AppBlueGreenDriver) Update added in v0.2.0

func (d *AppBlueGreenDriver) Update(ctx context.Context, image string) error

type AppCanaryDriver added in v0.2.0

type AppCanaryDriver struct {
	// contains filtered or unexported fields
}

AppCanaryDriver implements module.CanaryDriver for DigitalOcean App Platform.

DigitalOcean App Platform does not support native traffic splitting between app instances. RoutePercent returns a clear unsupported error directing users to DigitalOcean Load Balancer + Droplets for canary deployments.

CreateCanary, PromoteCanary, and DestroyCanary follow the standard create/promote/delete pattern using two separate apps.

func NewAppCanaryDriver added in v0.2.0

func NewAppCanaryDriver(c AppPlatformClient, region, stableID, stableName string) *AppCanaryDriver

NewAppCanaryDriver creates a CanaryDriver for DO App Platform.

func (*AppCanaryDriver) CheckMetricGate added in v0.2.0

func (d *AppCanaryDriver) CheckMetricGate(_ context.Context, _ string) error

CheckMetricGate always passes (no native metric integration).

func (*AppCanaryDriver) CreateCanary added in v0.2.0

func (d *AppCanaryDriver) CreateCanary(ctx context.Context, image string) error

CreateCanary creates a new App Platform app with the "-canary" name suffix and the given image.

func (*AppCanaryDriver) CurrentImage added in v0.2.0

func (d *AppCanaryDriver) CurrentImage(ctx context.Context) (string, error)

func (*AppCanaryDriver) DestroyCanary added in v0.2.0

func (d *AppCanaryDriver) DestroyCanary(ctx context.Context) error

DestroyCanary deletes the canary App Platform app.

func (*AppCanaryDriver) HealthCheck added in v0.2.0

func (d *AppCanaryDriver) HealthCheck(ctx context.Context, path string) error

func (*AppCanaryDriver) PromoteCanary added in v0.2.0

func (d *AppCanaryDriver) PromoteCanary(ctx context.Context) error

PromoteCanary updates the stable app with the canary image and deletes the canary.

func (*AppCanaryDriver) ReplicaCount added in v0.2.0

func (d *AppCanaryDriver) ReplicaCount(ctx context.Context) (int, error)

func (*AppCanaryDriver) RoutePercent added in v0.2.0

func (d *AppCanaryDriver) RoutePercent(_ context.Context, percent int) error

RoutePercent is not supported by DigitalOcean App Platform. Use DigitalOcean Load Balancer with Droplets for canary traffic splitting.

func (*AppCanaryDriver) Update added in v0.2.0

func (d *AppCanaryDriver) Update(ctx context.Context, image string) error

type AppDeployDriver added in v0.2.0

type AppDeployDriver struct {
	// contains filtered or unexported fields
}

AppDeployDriver implements module.DeployDriver for DigitalOcean App Platform. It manages a single App Platform application identified by its app ID.

func NewAppDeployDriver added in v0.2.0

func NewAppDeployDriver(c AppPlatformClient, region, appID, appName string) *AppDeployDriver

NewAppDeployDriver creates a DeployDriver backed by a DO App Platform app.

func (*AppDeployDriver) CurrentImage added in v0.2.0

func (d *AppDeployDriver) CurrentImage(ctx context.Context) (string, error)

func (*AppDeployDriver) HealthCheck added in v0.2.0

func (d *AppDeployDriver) HealthCheck(ctx context.Context, _ string) error

func (*AppDeployDriver) ReplicaCount added in v0.2.0

func (d *AppDeployDriver) ReplicaCount(ctx context.Context) (int, error)

func (*AppDeployDriver) Update added in v0.2.0

func (d *AppDeployDriver) Update(ctx context.Context, image string) error

type AppPlatformClient

type AppPlatformClient interface {
	Create(ctx context.Context, req *godo.AppCreateRequest) (*godo.App, *godo.Response, error)
	Get(ctx context.Context, appID string) (*godo.App, *godo.Response, error)
	List(ctx context.Context, opts *godo.ListOptions) ([]*godo.App, *godo.Response, error)
	Update(ctx context.Context, appID string, req *godo.AppUpdateRequest) (*godo.App, *godo.Response, error)
	CreateDeployment(ctx context.Context, appID string, req ...*godo.DeploymentCreateRequest) (*godo.Deployment, *godo.Response, error)
	Delete(ctx context.Context, appID string) (*godo.Response, error)
}

AppPlatformClient is the godo App interface used by AppPlatformDriver (for mocking).

type AppPlatformDriver

type AppPlatformDriver struct {
	// contains filtered or unexported fields
}

AppPlatformDriver manages DigitalOcean App Platform (infra.container_service).

func NewAppPlatformDriver

func NewAppPlatformDriver(c *godo.Client, region string) *AppPlatformDriver

NewAppPlatformDriver creates an AppPlatformDriver backed by a real godo client.

func NewAppPlatformDriverWithClient

func NewAppPlatformDriverWithClient(c AppPlatformClient, region string) *AppPlatformDriver

NewAppPlatformDriverWithClient creates a driver with an injected client (for tests).

func (*AppPlatformDriver) Create

func (*AppPlatformDriver) Delete

func (*AppPlatformDriver) Diff

func (*AppPlatformDriver) HealthCheck

func (*AppPlatformDriver) Read

func (*AppPlatformDriver) Scale

func (*AppPlatformDriver) SensitiveKeys added in v0.2.1

func (d *AppPlatformDriver) SensitiveKeys() []string

func (*AppPlatformDriver) SupportsUpsert added in v0.7.2

func (d *AppPlatformDriver) SupportsUpsert() bool

SupportsUpsert reports that AppPlatformDriver can locate a resource by name alone (empty ProviderID), enabling the ErrResourceAlreadyExists → upsert path in DOProvider.Apply. Other drivers that require ProviderID in Read do not implement this method and are excluded from the upsert path.

func (*AppPlatformDriver) Update

type CacheClient added in v0.1.1

type CacheClient interface {
	Create(ctx context.Context, req *godo.DatabaseCreateRequest) (*godo.Database, *godo.Response, error)
	Get(ctx context.Context, databaseID string) (*godo.Database, *godo.Response, error)
	Resize(ctx context.Context, databaseID string, req *godo.DatabaseResizeRequest) (*godo.Response, error)
	Delete(ctx context.Context, databaseID string) (*godo.Response, error)
}

CacheClient is the godo Databases interface used for Redis cache clusters (for mocking).

type CacheDriver added in v0.1.1

type CacheDriver struct {
	// contains filtered or unexported fields
}

CacheDriver manages DigitalOcean Managed Redis clusters (infra.cache). It uses the same Databases API as DatabaseDriver with engine=redis.

func NewCacheDriver added in v0.1.1

func NewCacheDriver(c *godo.Client, region string) *CacheDriver

NewCacheDriver creates a CacheDriver backed by a real godo client.

func NewCacheDriverWithClient added in v0.1.1

func NewCacheDriverWithClient(c CacheClient, region string) *CacheDriver

NewCacheDriverWithClient creates a driver with an injected client (for tests).

func (*CacheDriver) Create added in v0.1.1

func (*CacheDriver) Delete added in v0.1.1

func (d *CacheDriver) Delete(ctx context.Context, ref interfaces.ResourceRef) error

func (*CacheDriver) Diff added in v0.1.1

func (*CacheDriver) HealthCheck added in v0.1.1

func (*CacheDriver) Read added in v0.1.1

func (*CacheDriver) Scale added in v0.1.1

func (*CacheDriver) SensitiveKeys added in v0.2.1

func (d *CacheDriver) SensitiveKeys() []string

func (*CacheDriver) Update added in v0.1.1

type CertificateClient

type CertificateClient interface {
	Create(ctx context.Context, req *godo.CertificateRequest) (*godo.Certificate, *godo.Response, error)
	Get(ctx context.Context, certID string) (*godo.Certificate, *godo.Response, error)
	Delete(ctx context.Context, certID string) (*godo.Response, error)
	List(ctx context.Context, opts *godo.ListOptions) ([]godo.Certificate, *godo.Response, error)
}

CertificateClient is the godo Certificates interface (for mocking).

type CertificateDriver

type CertificateDriver struct {
	// contains filtered or unexported fields
}

CertificateDriver manages DigitalOcean SSL/TLS certificates (infra.certificate).

func NewCertificateDriver

func NewCertificateDriver(c *godo.Client) *CertificateDriver

NewCertificateDriver creates a CertificateDriver backed by a real godo client.

func NewCertificateDriverWithClient

func NewCertificateDriverWithClient(c CertificateClient) *CertificateDriver

NewCertificateDriverWithClient creates a driver with an injected client (for tests).

func (*CertificateDriver) Create

func (*CertificateDriver) Delete

func (*CertificateDriver) Diff

func (*CertificateDriver) HealthCheck

func (*CertificateDriver) Read

func (*CertificateDriver) Scale

func (*CertificateDriver) SensitiveKeys added in v0.2.1

func (d *CertificateDriver) SensitiveKeys() []string

func (*CertificateDriver) Update

type DNSDriver

type DNSDriver struct {
	// contains filtered or unexported fields
}

DNSDriver manages DigitalOcean Domains and DNS records (infra.dns). Idempotent: creates domain if missing, creates or updates records.

func NewDNSDriver

func NewDNSDriver(c *godo.Client) *DNSDriver

NewDNSDriver creates a DNSDriver backed by a real godo client.

func NewDNSDriverWithClient

func NewDNSDriverWithClient(c DomainsClient) *DNSDriver

NewDNSDriverWithClient creates a driver with an injected client (for tests).

func (*DNSDriver) Create

Create creates a domain and any declared DNS records idempotently. Config keys:

domain   string            — the zone name (e.g. "example.com")
records  []map[string]any  — each: {type, name, data, ttl}

func (*DNSDriver) Delete

func (d *DNSDriver) Delete(ctx context.Context, ref interfaces.ResourceRef) error

func (*DNSDriver) Diff

func (*DNSDriver) HealthCheck

func (*DNSDriver) Read

func (*DNSDriver) Scale

func (*DNSDriver) SensitiveKeys added in v0.2.1

func (d *DNSDriver) SensitiveKeys() []string

type DatabaseClient

type DatabaseClient interface {
	Create(ctx context.Context, req *godo.DatabaseCreateRequest) (*godo.Database, *godo.Response, error)
	Get(ctx context.Context, databaseID string) (*godo.Database, *godo.Response, error)
	Resize(ctx context.Context, databaseID string, req *godo.DatabaseResizeRequest) (*godo.Response, error)
	Delete(ctx context.Context, databaseID string) (*godo.Response, error)
	UpdateFirewallRules(ctx context.Context, databaseID string, req *godo.DatabaseUpdateFirewallRulesRequest) (*godo.Response, error)
}

DatabaseClient is the godo Databases interface (for mocking).

type DatabaseDriver

type DatabaseDriver struct {
	// contains filtered or unexported fields
}

DatabaseDriver manages DigitalOcean Managed Databases (infra.database). Supports pg, mysql, redis, mongodb, kafka.

func NewDatabaseDriver

func NewDatabaseDriver(c *godo.Client, region string) *DatabaseDriver

NewDatabaseDriver creates a DatabaseDriver backed by a real godo client.

func NewDatabaseDriverWithClient

func NewDatabaseDriverWithClient(c DatabaseClient, region string) *DatabaseDriver

NewDatabaseDriverWithClient creates a driver with an injected client (for tests).

func (*DatabaseDriver) Create

func (*DatabaseDriver) Delete

func (*DatabaseDriver) Diff

func (*DatabaseDriver) HealthCheck

func (*DatabaseDriver) Read

func (*DatabaseDriver) Scale

func (*DatabaseDriver) SensitiveKeys added in v0.2.1

func (d *DatabaseDriver) SensitiveKeys() []string

func (*DatabaseDriver) Update

type DomainsClient

type DomainsClient interface {
	Create(ctx context.Context, req *godo.DomainCreateRequest) (*godo.Domain, *godo.Response, error)
	Get(ctx context.Context, name string) (*godo.Domain, *godo.Response, error)
	Delete(ctx context.Context, name string) (*godo.Response, error)
	CreateRecord(ctx context.Context, domain string, req *godo.DomainRecordEditRequest) (*godo.DomainRecord, *godo.Response, error)
	EditRecord(ctx context.Context, domain string, id int, req *godo.DomainRecordEditRequest) (*godo.DomainRecord, *godo.Response, error)
	DeleteRecord(ctx context.Context, domain string, id int) (*godo.Response, error)
	Records(ctx context.Context, domain string, opts *godo.ListOptions) ([]godo.DomainRecord, *godo.Response, error)
}

DomainsClient is the godo Domains interface (for mocking).

type DropletDriver

type DropletDriver struct {
	// contains filtered or unexported fields
}

DropletDriver manages DigitalOcean Droplets (infra.droplet).

func NewDropletDriver

func NewDropletDriver(c *godo.Client, region string) *DropletDriver

NewDropletDriver creates a DropletDriver backed by a real godo client.

func NewDropletDriverWithClient

func NewDropletDriverWithClient(c DropletsClient, region string) *DropletDriver

NewDropletDriverWithClient creates a driver with an injected client (for tests).

func (*DropletDriver) Create

func (*DropletDriver) Delete

func (*DropletDriver) Diff

func (*DropletDriver) HealthCheck

func (*DropletDriver) Read

func (*DropletDriver) Scale

func (*DropletDriver) SensitiveKeys added in v0.2.1

func (d *DropletDriver) SensitiveKeys() []string

type DropletsClient

type DropletsClient interface {
	Create(ctx context.Context, req *godo.DropletCreateRequest) (*godo.Droplet, *godo.Response, error)
	Get(ctx context.Context, dropletID int) (*godo.Droplet, *godo.Response, error)
	Delete(ctx context.Context, dropletID int) (*godo.Response, error)
}

DropletsClient is the godo Droplets interface (for mocking).

type FirewallClient

type FirewallClient interface {
	Create(ctx context.Context, req *godo.FirewallRequest) (*godo.Firewall, *godo.Response, error)
	Get(ctx context.Context, fwID string) (*godo.Firewall, *godo.Response, error)
	Update(ctx context.Context, fwID string, req *godo.FirewallRequest) (*godo.Firewall, *godo.Response, error)
	Delete(ctx context.Context, fwID string) (*godo.Response, error)
}

FirewallClient is the godo Firewalls interface (for mocking).

type FirewallDriver

type FirewallDriver struct {
	// contains filtered or unexported fields
}

FirewallDriver manages DigitalOcean Firewalls (infra.firewall).

func NewFirewallDriver

func NewFirewallDriver(c *godo.Client) *FirewallDriver

NewFirewallDriver creates a FirewallDriver backed by a real godo client.

func NewFirewallDriverWithClient

func NewFirewallDriverWithClient(c FirewallClient) *FirewallDriver

NewFirewallDriverWithClient creates a driver with an injected client (for tests).

func (*FirewallDriver) Create

func (*FirewallDriver) Delete

func (*FirewallDriver) Diff

func (*FirewallDriver) HealthCheck

func (*FirewallDriver) Read

func (*FirewallDriver) Scale

func (*FirewallDriver) SensitiveKeys added in v0.2.1

func (d *FirewallDriver) SensitiveKeys() []string

func (*FirewallDriver) Update

type IAMRoleDriver added in v0.1.1

type IAMRoleDriver struct{}

IAMRoleDriver provides a ResourceDriver for infra.iam_role on DigitalOcean.

Limitation

DigitalOcean does not expose fine-grained IAM role management via the godo API. Personal Access Tokens and OAuth applications must be created through the DO control panel (https://cloud.digitalocean.com/account/api/tokens).

This driver is entirely declarative: Create/Update return the declared config as outputs with a limitation notice; Read/HealthCheck return a healthy declared state; Delete and Scale are no-ops. No godo API calls are made.

func NewIAMRoleDriver added in v0.1.1

func NewIAMRoleDriver() *IAMRoleDriver

NewIAMRoleDriver creates an IAMRoleDriver.

func (*IAMRoleDriver) Create added in v0.1.1

Create records an IAM role declaration. Since DO has no native role API the driver returns the declared metadata as outputs with a clear limitation notice.

func (*IAMRoleDriver) Delete added in v0.1.1

func (*IAMRoleDriver) Diff added in v0.1.1

func (*IAMRoleDriver) HealthCheck added in v0.1.1

func (*IAMRoleDriver) Read added in v0.1.1

func (*IAMRoleDriver) Scale added in v0.1.1

func (*IAMRoleDriver) SensitiveKeys added in v0.2.1

func (d *IAMRoleDriver) SensitiveKeys() []string

func (*IAMRoleDriver) Update added in v0.1.1

type KubernetesClient

KubernetesClient is the godo Kubernetes interface (for mocking).

type KubernetesDriver

type KubernetesDriver struct {
	// contains filtered or unexported fields
}

KubernetesDriver manages DigitalOcean Kubernetes Service (DOKS) clusters (infra.k8s_cluster).

func NewKubernetesDriver

func NewKubernetesDriver(c *godo.Client, region string) *KubernetesDriver

NewKubernetesDriver creates a KubernetesDriver backed by a real godo client.

func NewKubernetesDriverWithClient

func NewKubernetesDriverWithClient(c KubernetesClient, region string) *KubernetesDriver

NewKubernetesDriverWithClient creates a driver with an injected client (for tests).

func (*KubernetesDriver) Create

func (*KubernetesDriver) Delete

func (*KubernetesDriver) Diff

func (*KubernetesDriver) HealthCheck

func (*KubernetesDriver) Read

func (*KubernetesDriver) Scale

Scale resizes the first node pool of the cluster to the given replica count using godo.Kubernetes.UpdateNodePool.

func (*KubernetesDriver) SensitiveKeys added in v0.2.1

func (d *KubernetesDriver) SensitiveKeys() []string

func (*KubernetesDriver) Update

type LoadBalancerClient

type LoadBalancerClient interface {
	Create(ctx context.Context, req *godo.LoadBalancerRequest) (*godo.LoadBalancer, *godo.Response, error)
	Get(ctx context.Context, lbID string) (*godo.LoadBalancer, *godo.Response, error)
	Update(ctx context.Context, lbID string, req *godo.LoadBalancerRequest) (*godo.LoadBalancer, *godo.Response, error)
	Delete(ctx context.Context, lbID string) (*godo.Response, error)
}

LoadBalancerClient is the godo LoadBalancers interface (for mocking).

type LoadBalancerDriver

type LoadBalancerDriver struct {
	// contains filtered or unexported fields
}

LoadBalancerDriver manages DigitalOcean Load Balancers (infra.load_balancer).

func NewLoadBalancerDriver

func NewLoadBalancerDriver(c *godo.Client, region string) *LoadBalancerDriver

NewLoadBalancerDriver creates a LoadBalancerDriver backed by a real godo client.

func NewLoadBalancerDriverWithClient

func NewLoadBalancerDriverWithClient(c LoadBalancerClient, region string) *LoadBalancerDriver

NewLoadBalancerDriverWithClient creates a driver with an injected client (for tests).

func (*LoadBalancerDriver) Create

func (*LoadBalancerDriver) Delete

func (*LoadBalancerDriver) Diff

func (*LoadBalancerDriver) HealthCheck

func (*LoadBalancerDriver) Read

func (*LoadBalancerDriver) Scale

func (*LoadBalancerDriver) SensitiveKeys added in v0.2.1

func (d *LoadBalancerDriver) SensitiveKeys() []string

func (*LoadBalancerDriver) Update

type RegistryClient

type RegistryClient interface {
	Create(ctx context.Context, req *godo.RegistryCreateRequest) (*godo.Registry, *godo.Response, error)
	Get(ctx context.Context) (*godo.Registry, *godo.Response, error)
	Delete(ctx context.Context) (*godo.Response, error)
}

RegistryClient is the godo Registry interface (for mocking).

type RegistryDriver

type RegistryDriver struct {
	// contains filtered or unexported fields
}

RegistryDriver manages the DigitalOcean Container Registry (infra.registry). Note: DOCR supports one registry per account; Create is idempotent.

func NewRegistryDriver

func NewRegistryDriver(c *godo.Client) *RegistryDriver

NewRegistryDriver creates a RegistryDriver backed by a real godo client.

func NewRegistryDriverWithClient

func NewRegistryDriverWithClient(c RegistryClient) *RegistryDriver

NewRegistryDriverWithClient creates a driver with an injected client (for tests).

func (*RegistryDriver) Create

func (*RegistryDriver) Delete

func (*RegistryDriver) Diff

func (*RegistryDriver) HealthCheck

func (*RegistryDriver) Read

func (*RegistryDriver) Scale

func (*RegistryDriver) SensitiveKeys added in v0.2.1

func (d *RegistryDriver) SensitiveKeys() []string

type SpacesBucket

type SpacesBucket struct {
	Name      string
	Region    string
	CreatedAt time.Time
}

SpacesBucket is a minimal representation of a DigitalOcean Spaces bucket.

type SpacesBucketClient

type SpacesBucketClient interface {
	CreateBucket(ctx context.Context, name, region string) (*SpacesBucket, error)
	GetBucket(ctx context.Context, name, region string) (*SpacesBucket, error)
	DeleteBucket(ctx context.Context, name, region string) error
}

SpacesBucketClient is the interface for Spaces bucket management (injectable for mocking). DigitalOcean Spaces uses an S3-compatible API; this interface abstracts those calls.

type SpacesDriver

type SpacesDriver struct {
	// contains filtered or unexported fields
}

SpacesDriver manages DigitalOcean Spaces object storage buckets (infra.storage).

func NewSpacesDriver

func NewSpacesDriver(_ *godo.Client, region, accessKey, secretKey string) *SpacesDriver

NewSpacesDriver creates a SpacesDriver. If accessKey and secretKey are non-empty a real S3-compatible client is used; otherwise a no-op client is used (suitable only for tests / dry-run mode).

func NewSpacesDriverWithClient

func NewSpacesDriverWithClient(c SpacesBucketClient, region string) *SpacesDriver

NewSpacesDriverWithClient creates a driver with an injected client (for tests).

func (*SpacesDriver) Create

func (*SpacesDriver) Delete

func (*SpacesDriver) Diff

func (*SpacesDriver) HealthCheck

func (*SpacesDriver) Read

func (*SpacesDriver) Scale

func (*SpacesDriver) SensitiveKeys added in v0.2.1

func (d *SpacesDriver) SensitiveKeys() []string

type VPCClient

type VPCClient interface {
	Create(ctx context.Context, req *godo.VPCCreateRequest) (*godo.VPC, *godo.Response, error)
	Get(ctx context.Context, vpcID string) (*godo.VPC, *godo.Response, error)
	Update(ctx context.Context, vpcID string, req *godo.VPCUpdateRequest) (*godo.VPC, *godo.Response, error)
	Delete(ctx context.Context, vpcID string) (*godo.Response, error)
}

VPCClient is the godo VPCs interface (for mocking).

type VPCDriver

type VPCDriver struct {
	// contains filtered or unexported fields
}

VPCDriver manages DigitalOcean VPCs (infra.vpc).

func NewVPCDriver

func NewVPCDriver(c *godo.Client, region string) *VPCDriver

NewVPCDriver creates a VPCDriver backed by a real godo client.

func NewVPCDriverWithClient

func NewVPCDriverWithClient(c VPCClient, region string) *VPCDriver

NewVPCDriverWithClient creates a driver with an injected client (for tests).

func (*VPCDriver) Create

func (*VPCDriver) Delete

func (d *VPCDriver) Delete(ctx context.Context, ref interfaces.ResourceRef) error

func (*VPCDriver) Diff

func (*VPCDriver) HealthCheck

func (*VPCDriver) Read

func (*VPCDriver) Scale

func (*VPCDriver) SensitiveKeys added in v0.2.1

func (d *VPCDriver) SensitiveKeys() []string

Jump to

Keyboard shortcuts

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