Documentation
¶
Overview ¶
Package internal implements the DigitalOcean workflow engine plugin.
Index ¶
- Variables
- func NewDOPlugin() sdk.PluginProvider
- type DOProvider
- func (p *DOProvider) Apply(ctx context.Context, plan *interfaces.IaCPlan) (*interfaces.ApplyResult, error)
- func (p *DOProvider) BootstrapStateBackend(ctx context.Context, cfg map[string]any) (*interfaces.BootstrapResult, error)
- func (p *DOProvider) Capabilities() []interfaces.IaCCapabilityDeclaration
- func (p *DOProvider) Close() error
- func (p *DOProvider) Destroy(ctx context.Context, resources []interfaces.ResourceRef) (*interfaces.DestroyResult, error)
- func (p *DOProvider) DetectDrift(_ context.Context, resources []interfaces.ResourceRef) ([]interfaces.DriftResult, error)
- func (p *DOProvider) Import(ctx context.Context, cloudID string, resourceType string) (*interfaces.ResourceState, error)
- func (p *DOProvider) Initialize(_ context.Context, config map[string]any) error
- func (p *DOProvider) Name() string
- func (p *DOProvider) Plan(_ context.Context, desired []interfaces.ResourceSpec, ...) (*interfaces.IaCPlan, error)
- func (p *DOProvider) ResolveSizing(resourceType string, size interfaces.Size, hints *interfaces.ResourceHints) (*interfaces.ProviderSizing, error)
- func (p *DOProvider) ResourceDriver(resourceType string) (interfaces.ResourceDriver, error)
- func (p *DOProvider) Status(ctx context.Context, resources []interfaces.ResourceRef) ([]interfaces.ResourceStatus, error)
- func (p *DOProvider) SupportedCanonicalKeys() []string
- func (p *DOProvider) Version() string
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is set at build time via -ldflags "-X github.com/GoCodeAlone/workflow-plugin-digitalocean/internal.Version=X.Y.Z"
Functions ¶
func NewDOPlugin ¶
func NewDOPlugin() sdk.PluginProvider
NewDOPlugin returns a new DigitalOcean plugin instance.
Types ¶
type DOProvider ¶
type DOProvider struct {
// contains filtered or unexported fields
}
DOProvider implements interfaces.IaCProvider for DigitalOcean.
func NewDOProvider ¶
func NewDOProvider() *DOProvider
NewDOProvider creates an uninitialised DOProvider.
func (*DOProvider) Apply ¶
func (p *DOProvider) Apply(ctx context.Context, plan *interfaces.IaCPlan) (*interfaces.ApplyResult, error)
Apply executes the plan.
func (*DOProvider) BootstrapStateBackend ¶ added in v0.7.4
func (p *DOProvider) BootstrapStateBackend(ctx context.Context, cfg map[string]any) (*interfaces.BootstrapResult, error)
BootstrapStateBackend ensures the DO Spaces state bucket exists. It is idempotent: if the bucket already exists it returns the metadata without error. Providers that do not manage a state backend should return (nil, nil).
Required cfg keys: "bucket", and credentials supplied as either camelCase ("accessKey"/"secretKey", e.g. BMW infra.yaml) or snake_case ("access_key"/"secret_key"); camelCase is checked first. Optional cfg keys: "region" (falls back to the provider's configured region, then "nyc3" as the ultimate default).
Returns a BootstrapResult with:
- Bucket, Region, Endpoint fields populated
- EnvVars: WFCTL_STATE_BUCKET and SPACES_BUCKET set to the bucket name
func (*DOProvider) Capabilities ¶
func (p *DOProvider) Capabilities() []interfaces.IaCCapabilityDeclaration
Capabilities returns the resource types this provider supports.
func (*DOProvider) Close ¶
func (p *DOProvider) Close() error
Close is a no-op; the godo client has no persistent connection to close.
func (*DOProvider) Destroy ¶
func (p *DOProvider) Destroy(ctx context.Context, resources []interfaces.ResourceRef) (*interfaces.DestroyResult, error)
Destroy deletes the given resources.
func (*DOProvider) DetectDrift ¶
func (p *DOProvider) DetectDrift(_ context.Context, resources []interfaces.ResourceRef) ([]interfaces.DriftResult, error)
DetectDrift checks for drift between declared and actual resource state.
func (*DOProvider) Import ¶
func (p *DOProvider) Import(ctx context.Context, cloudID string, resourceType string) (*interfaces.ResourceState, error)
Import brings an existing cloud resource under management.
func (*DOProvider) Initialize ¶
Initialize configures the godo client using the provided config map. Required: "token". Optional: "region" (default "nyc3"), "spaces_access_key", "spaces_secret_key".
func (*DOProvider) Name ¶
func (p *DOProvider) Name() string
func (*DOProvider) Plan ¶
func (p *DOProvider) Plan(_ context.Context, desired []interfaces.ResourceSpec, current []interfaces.ResourceState) (*interfaces.IaCPlan, error)
Plan computes the set of actions needed to reach the desired state.
func (*DOProvider) ResolveSizing ¶
func (p *DOProvider) ResolveSizing(resourceType string, size interfaces.Size, hints *interfaces.ResourceHints) (*interfaces.ProviderSizing, error)
ResolveSizing maps abstract size tiers to DigitalOcean SKUs.
func (*DOProvider) ResourceDriver ¶
func (p *DOProvider) ResourceDriver(resourceType string) (interfaces.ResourceDriver, error)
ResourceDriver returns the driver for the given resource type.
func (*DOProvider) Status ¶
func (p *DOProvider) Status(ctx context.Context, resources []interfaces.ResourceRef) ([]interfaces.ResourceStatus, error)
Status returns the live status of the given resources.
func (*DOProvider) SupportedCanonicalKeys ¶ added in v0.7.0
func (p *DOProvider) SupportedCanonicalKeys() []string
SupportedCanonicalKeys returns the canonical IaC config keys that this DO provider currently maps. Keys in doUnsupportedCanonicalKeys are excluded until their Task implementation lands (see comments there).
func (*DOProvider) Version ¶
func (p *DOProvider) Version() string