Help us shape the future of Go! Take the 2026 Go Developer Survey

sdk

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sdk is the supported way to drive docket's engine from Go: build and run tasks, read a server back as a recipe, and describe the registered task types.

Everything else in the module lives under internal/ and cannot be imported from outside it. The recipe loader, the codecs, template rendering and the CLI are docket's own business; this package is the part meant to be built on.

Stability

The exported identifiers in this package are stable from the release they first ship in. While docket is at 0.x, a change that breaks a caller only ships in a release that bumps the minor version, and the release notes call it out. From 1.0 on, only in a major version.

The one exception is the fields of the task types (AppTask, ConfigTask and so on). They mirror the recipe format, and change when it does: a field added, renamed or removed in a recipe is added, renamed or removed here in the same release.

Types are aliases of the engine's own, so a value built here is the value the engine runs. Every type their exported fields and methods take or return is named here too.

Runs

Every call takes a context.Context, and the context carries what a run needs: the server to send dokku commands to and the values to mask. Build it from a Session, which also owns the SSH connections made under it:

session := sdk.NewSession(sdk.NewMasker("s3cr3t"))
defer func() { _ = session.Close() }()
ctx := session.Context(context.Background(), sdk.Target{Host: "dokku@dokku.example.com"})

The zero Target runs dokku locally.

Index

Examples

Constants

View Source
const (
	TypeString  = tasks.TypeString
	TypeBool    = tasks.TypeBool
	TypeInt     = tasks.TypeInt
	TypeFloat   = tasks.TypeFloat
	TypeList    = tasks.TypeList
	TypeDict    = tasks.TypeDict
	TypeObject  = tasks.TypeObject
	TypeAny     = tasks.TypeAny
	TypeUnknown = tasks.TypeUnknown
)

Field and item type names used in FieldSchema.Type and ItemSchema.Type.

View Source
const (
	IdentityRoleKey        = tasks.IdentityRoleKey
	IdentityRoleCollection = tasks.IdentityRoleCollection
)

Identity roles a FieldSchema can carry.

View Source
const (
	ItemIdentityValue  = tasks.ItemIdentityValue
	ItemIdentityMapKey = tasks.ItemIdentityMapKey
	ItemIdentityFields = tasks.ItemIdentityFields
)

How a collection's items are told apart.

View Source
const (
	PropertyScopeApp    = tasks.PropertyScopeApp
	PropertyScopeGlobal = tasks.PropertyScopeGlobal
)

Scopes a property can be set in.

View Source
const (
	ProbeSupported   = tasks.ProbeSupported
	ProbePartial     = tasks.ProbePartial
	ProbeUnsupported = tasks.ProbeUnsupported

	ExportSupported   = tasks.ExportSupported
	ExportPartial     = tasks.ExportPartial
	ExportUnsupported = tasks.ExportUnsupported
)

Probe and export support levels.

View Source
const (
	FormatYAML  = tasks.FormatYAML
	FormatJSON5 = tasks.FormatNameJSON5
	FormatHCL   = tasks.FormatNameHCL
)

Recipe formats ExportResult.MarshalRecipe accepts.

View Source
const (
	StatePresent  = tasks.StatePresent
	StateAbsent   = tasks.StateAbsent
	StateDeployed = tasks.StateDeployed
	StateSet      = tasks.StateSet
	StateClear    = tasks.StateClear
)

Task states.

View Source
const (
	PlanStatusOK      = tasks.PlanStatusOK
	PlanStatusModify  = tasks.PlanStatusModify
	PlanStatusCreate  = tasks.PlanStatusCreate
	PlanStatusDestroy = tasks.PlanStatusDestroy
	PlanStatusError   = tasks.PlanStatusError
)

Plan statuses, as PlanResult.Status.

View Source
const (
	WarnReasonUnknownProperty    = tasks.WarnReasonUnknownProperty
	WarnReasonProbeRejected      = tasks.WarnReasonProbeRejected
	WarnReasonProbeIndeterminate = tasks.WarnReasonProbeIndeterminate
	WarnReasonServiceImageDrift  = tasks.WarnReasonServiceImageDrift
)

PlanWarning reasons.

View Source
const CatalogVersion = tasks.CatalogVersion

CatalogVersion is the TaskCatalog.Version this release emits. It changes only when the catalog's shape does, so a consumer can branch on it.

View Source
const MaskPlaceholder = subprocess.MaskPlaceholder

MaskPlaceholder is what a Masker replaces a sensitive value with.

View Source
const PropertyFieldName = tasks.PropertyFieldName

PropertyFieldName is the recipe key every property table constrains.

Variables

View Source
var ErrSessionClosed = subprocess.ErrSessionClosed

ErrSessionClosed is the error a call made under a closed session fails with. Test for it with errors.Is.

Functions

func As

func As[T Task](e ExportedTask) (T, bool)

As returns an exported task's body as T, the value type registered under e.Type (ConfigTask, not *ConfigTask). It reports false for any other type.

func ContextWithTarget

func ContextWithTarget(ctx context.Context, target Target) context.Context

ContextWithTarget returns a copy of ctx that sends dokku commands to target. A context derived from a session context still belongs to that session.

func IdentityAddress

func IdentityAddress(typeKey string, t Task) string

IdentityAddress renders the resource t addresses, such as `dokku_config[app=api]`. It is the form ParseIdentityAddress and ParseResourceSelectors read back.

func ParseIdentityAddress

func ParseIdentityAddress(address string) (string, map[string]string, error)

ParseIdentityAddress parses `dokku_config[app=api]` into its type key and key map. A bare type key parses to an empty map.

func TaskDeprecation

func TaskDeprecation(t Task) string

TaskDeprecation returns t's deprecation notice, or "" when t is current.

func TaskSynopsis

func TaskSynopsis(t Task) string

TaskSynopsis returns t's description, or "" when it has none.

func TaskTypes

func TaskTypes() []string

TaskTypes returns every registered task type, sorted. The slice is the caller's own.

Example
package main

import (
	"fmt"

	"github.com/dokku/docket/sdk"
)

func main() {
	for _, typeKey := range sdk.TaskTypes() {
		task, _ := sdk.Lookup(typeKey)
		if typeKey == "dokku_app" {
			fmt.Println(typeKey, "-", sdk.TaskSynopsis(task))
		}
	}
}
Output:
dokku_app - Creates or destroys an app

Types

type AclAppTask

type AclAppTask = tasks.AclAppTask

AclAppTask is tasks.AclAppTask.

type AclServiceTask

type AclServiceTask = tasks.AclServiceTask

AclServiceTask is tasks.AclServiceTask.

type AppCloneTask

type AppCloneTask = tasks.AppCloneTask

AppCloneTask is tasks.AppCloneTask.

type AppJsonPropertyTask

type AppJsonPropertyTask = tasks.AppJsonPropertyTask

AppJsonPropertyTask is tasks.AppJsonPropertyTask.

type AppLockTask

type AppLockTask = tasks.AppLockTask

AppLockTask is tasks.AppLockTask.

type AppTask

type AppTask = tasks.AppTask

AppTask is tasks.AppTask.

type AppsPropertyTask

type AppsPropertyTask = tasks.AppsPropertyTask

AppsPropertyTask is tasks.AppsPropertyTask.

type BuilderDockerfilePropertyTask

type BuilderDockerfilePropertyTask = tasks.BuilderDockerfilePropertyTask

BuilderDockerfilePropertyTask is tasks.BuilderDockerfilePropertyTask.

type BuilderHerokuishPropertyTask

type BuilderHerokuishPropertyTask = tasks.BuilderHerokuishPropertyTask

BuilderHerokuishPropertyTask is tasks.BuilderHerokuishPropertyTask.

type BuilderLambdaPropertyTask

type BuilderLambdaPropertyTask = tasks.BuilderLambdaPropertyTask

BuilderLambdaPropertyTask is tasks.BuilderLambdaPropertyTask.

type BuilderNixpacksPropertyTask

type BuilderNixpacksPropertyTask = tasks.BuilderNixpacksPropertyTask

BuilderNixpacksPropertyTask is tasks.BuilderNixpacksPropertyTask.

type BuilderPackPropertyTask

type BuilderPackPropertyTask = tasks.BuilderPackPropertyTask

BuilderPackPropertyTask is tasks.BuilderPackPropertyTask.

type BuilderPropertyTask

type BuilderPropertyTask = tasks.BuilderPropertyTask

BuilderPropertyTask is tasks.BuilderPropertyTask.

type BuilderRailpackPropertyTask

type BuilderRailpackPropertyTask = tasks.BuilderRailpackPropertyTask

BuilderRailpackPropertyTask is tasks.BuilderRailpackPropertyTask.

type BuildpacksPropertyTask

type BuildpacksPropertyTask = tasks.BuildpacksPropertyTask

BuildpacksPropertyTask is tasks.BuildpacksPropertyTask.

type BuildpacksTask

type BuildpacksTask = tasks.BuildpacksTask

BuildpacksTask is tasks.BuildpacksTask.

type BuildsPropertyTask

type BuildsPropertyTask = tasks.BuildsPropertyTask

BuildsPropertyTask is tasks.BuildsPropertyTask.

type CaddyPropertyTask

type CaddyPropertyTask = tasks.CaddyPropertyTask

CaddyPropertyTask is tasks.CaddyPropertyTask.

type CertsTask

type CertsTask = tasks.CertsTask

CertsTask is tasks.CertsTask.

type ChecksPropertyTask

type ChecksPropertyTask = tasks.ChecksPropertyTask

ChecksPropertyTask is tasks.ChecksPropertyTask.

type ChecksToggleTask

type ChecksToggleTask = tasks.ChecksToggleTask

ChecksToggleTask is tasks.ChecksToggleTask.

type ConfigTask

type ConfigTask = tasks.ConfigTask

ConfigTask is tasks.ConfigTask.

type CronPropertyTask

type CronPropertyTask = tasks.CronPropertyTask

CronPropertyTask is tasks.CronPropertyTask.

type DockerOptionsTask

type DockerOptionsTask = tasks.DockerOptionsTask

DockerOptionsTask is tasks.DockerOptionsTask.

type DomainsTask

type DomainsTask = tasks.DomainsTask

DomainsTask is tasks.DomainsTask.

type DomainsToggleTask

type DomainsToggleTask = tasks.DomainsToggleTask

DomainsToggleTask is tasks.DomainsToggleTask.

type DynamicPropertySchema

type DynamicPropertySchema = tasks.DynamicPropertySchema

DynamicPropertySchema is tasks.DynamicPropertySchema.

type ExampleSchema

type ExampleSchema = tasks.ExampleSchema

ExampleSchema is tasks.ExampleSchema.

type ExportOptions

type ExportOptions = tasks.ExportOptions

ExportOptions is tasks.ExportOptions.

type ExportReport

type ExportReport = tasks.ExportReport

ExportReport is tasks.ExportReport.

type ExportResult

type ExportResult = tasks.ExportResult

ExportResult is tasks.ExportResult.

func ExportRecipe

func ExportRecipe(ctx context.Context, opts ExportOptions) (*ExportResult, error)

ExportRecipe reads the server ctx targets and returns the recipe that describes it. An export that finds nothing is not an error: check Report.MissingApps and Report.MissingResources.

Example

Reading a server back and picking out one task type.

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/dokku/docket/sdk"
)

func main() {
	session := sdk.NewSession(nil)
	defer func() { _ = session.Close() }()
	ctx := session.Context(context.Background(), sdk.Target{Host: "dokku@dokku.example.com"})

	res, err := sdk.ExportRecipe(ctx, sdk.ExportOptions{Inline: true})
	if err != nil {
		panic(err)
	}

	// Register what the export read before printing anything it produced.
	masker := sdk.NewMasker(res.SensitiveValues()...)
	for _, w := range res.Report.Warnings {
		fmt.Fprintln(os.Stderr, masker.String(w))
	}

	for _, play := range res.Plays() {
		for _, task := range play.Tasks {
			cfg, ok := sdk.As[sdk.ConfigTask](task)
			if !ok {
				continue
			}
			fmt.Println(play.Name, cfg.App, len(cfg.Config))
		}
	}
}

type ExportStatus

type ExportStatus = tasks.ExportStatus

ExportStatus is tasks.ExportStatus.

type ExportSupport

type ExportSupport = tasks.ExportSupport

ExportSupport is tasks.ExportSupport.

func TaskExportSupport

func TaskExportSupport(t Task) (ExportSupport, bool)

TaskExportSupport reports whether ExportRecipe can reconstruct t from a server. The bool is false when t declares nothing.

type ExportedPlay

type ExportedPlay = tasks.ExportedPlay

ExportedPlay is tasks.ExportedPlay.

type ExportedTask

type ExportedTask = tasks.ExportedTask

ExportedTask is tasks.ExportedTask.

type FieldSchema

type FieldSchema = tasks.FieldSchema

FieldSchema is tasks.FieldSchema.

type GitAuthTask

type GitAuthTask = tasks.GitAuthTask

GitAuthTask is tasks.GitAuthTask.

type GitFromArchiveTask

type GitFromArchiveTask = tasks.GitFromArchiveTask

GitFromArchiveTask is tasks.GitFromArchiveTask.

type GitFromImageTask

type GitFromImageTask = tasks.GitFromImageTask

GitFromImageTask is tasks.GitFromImageTask.

type GitPropertyTask

type GitPropertyTask = tasks.GitPropertyTask

GitPropertyTask is tasks.GitPropertyTask.

type GitSyncTask

type GitSyncTask = tasks.GitSyncTask

GitSyncTask is tasks.GitSyncTask.

type HaproxyPropertyTask

type HaproxyPropertyTask = tasks.HaproxyPropertyTask

HaproxyPropertyTask is tasks.HaproxyPropertyTask.

type HttpAuthAllowedIpTask

type HttpAuthAllowedIpTask = tasks.HttpAuthAllowedIpTask

HttpAuthAllowedIpTask is tasks.HttpAuthAllowedIpTask.

type HttpAuthDomainTask

type HttpAuthDomainTask = tasks.HttpAuthDomainTask

HttpAuthDomainTask is tasks.HttpAuthDomainTask.

type HttpAuthTask

type HttpAuthTask = tasks.HttpAuthTask

HttpAuthTask is tasks.HttpAuthTask.

type HttpAuthUser

type HttpAuthUser = tasks.HttpAuthUser

HttpAuthUser is tasks.HttpAuthUser.

type HttpAuthUserTask

type HttpAuthUserTask = tasks.HttpAuthUserTask

HttpAuthUserTask is tasks.HttpAuthUserTask.

type IdentityCollectionSchema

type IdentityCollectionSchema = tasks.IdentityCollectionSchema

IdentityCollectionSchema is tasks.IdentityCollectionSchema.

type IdentitySchema

type IdentitySchema = tasks.IdentitySchema

IdentitySchema is tasks.IdentitySchema.

type ItemIdentity

type ItemIdentity = tasks.ItemIdentity

ItemIdentity is tasks.ItemIdentity.

type ItemSchema

type ItemSchema = tasks.ItemSchema

ItemSchema is tasks.ItemSchema.

type LetsencryptPropertyTask

type LetsencryptPropertyTask = tasks.LetsencryptPropertyTask

LetsencryptPropertyTask is tasks.LetsencryptPropertyTask.

type LetsencryptTask

type LetsencryptTask = tasks.LetsencryptTask

LetsencryptTask is tasks.LetsencryptTask.

type LogsPropertyTask

type LogsPropertyTask = tasks.LogsPropertyTask

LogsPropertyTask is tasks.LogsPropertyTask.

type MaintenanceCustomPageTask

type MaintenanceCustomPageTask = tasks.MaintenanceCustomPageTask

MaintenanceCustomPageTask is tasks.MaintenanceCustomPageTask.

type MaintenanceTask

type MaintenanceTask = tasks.MaintenanceTask

MaintenanceTask is tasks.MaintenanceTask.

type Masker

type Masker = subprocess.Masker

Masker is subprocess.Masker.

func NewMasker

func NewMasker(values ...string) *Masker

NewMasker returns a masker for values.

type NetworkPropertyTask

type NetworkPropertyTask = tasks.NetworkPropertyTask

NetworkPropertyTask is tasks.NetworkPropertyTask.

type NetworkTask

type NetworkTask = tasks.NetworkTask

NetworkTask is tasks.NetworkTask.

type NginxPropertyTask

type NginxPropertyTask = tasks.NginxPropertyTask

NginxPropertyTask is tasks.NginxPropertyTask.

type OpenrestyPropertyTask

type OpenrestyPropertyTask = tasks.OpenrestyPropertyTask

OpenrestyPropertyTask is tasks.OpenrestyPropertyTask.

type PlanResult

type PlanResult = tasks.PlanResult

PlanResult is tasks.PlanResult.

type PlanStatus

type PlanStatus = tasks.PlanStatus

PlanStatus is tasks.PlanStatus.

type PlanWarning

type PlanWarning = tasks.PlanWarning

PlanWarning is tasks.PlanWarning.

type PluginRequirement

type PluginRequirement = tasks.PluginRequirement

PluginRequirement is tasks.PluginRequirement.

type PluginRequirementSchema

type PluginRequirementSchema = tasks.PluginRequirementSchema

PluginRequirementSchema is tasks.PluginRequirementSchema.

type PluginTask

type PluginTask = tasks.PluginTask

PluginTask is tasks.PluginTask.

type PortMapping

type PortMapping = tasks.PortMapping

PortMapping is tasks.PortMapping.

type PortsTask

type PortsTask = tasks.PortsTask

PortsTask is tasks.PortsTask.

type ProbeStatus

type ProbeStatus = tasks.ProbeStatus

ProbeStatus is tasks.ProbeStatus.

type ProbeSupport

type ProbeSupport = tasks.ProbeSupport

ProbeSupport is tasks.ProbeSupport.

func TaskProbeSupport

func TaskProbeSupport(t Task) (ProbeSupport, bool)

TaskProbeSupport reports how much of its own state t's Plan can read back. The bool is false when t declares nothing.

type PropertyEntrySchema

type PropertyEntrySchema = tasks.PropertyEntrySchema

PropertyEntrySchema is tasks.PropertyEntrySchema.

type PropertySchema

type PropertySchema = tasks.PropertySchema

PropertySchema is tasks.PropertySchema.

type ProxyPropertyTask

type ProxyPropertyTask = tasks.ProxyPropertyTask

ProxyPropertyTask is tasks.ProxyPropertyTask.

type ProxyToggleTask

type ProxyToggleTask = tasks.ProxyToggleTask

ProxyToggleTask is tasks.ProxyToggleTask.

type PsPropertyTask

type PsPropertyTask = tasks.PsPropertyTask

PsPropertyTask is tasks.PsPropertyTask.

type PsScaleTask

type PsScaleTask = tasks.PsScaleTask

PsScaleTask is tasks.PsScaleTask.

type RegistryAuthTask

type RegistryAuthTask = tasks.RegistryAuthTask

RegistryAuthTask is tasks.RegistryAuthTask.

type RegistryPropertyTask

type RegistryPropertyTask = tasks.RegistryPropertyTask

RegistryPropertyTask is tasks.RegistryPropertyTask.

type RejectedPropertySchema

type RejectedPropertySchema = tasks.RejectedPropertySchema

RejectedPropertySchema is tasks.RejectedPropertySchema.

type ResourceLimitTask

type ResourceLimitTask = tasks.ResourceLimitTask

ResourceLimitTask is tasks.ResourceLimitTask.

type ResourceReserveTask

type ResourceReserveTask = tasks.ResourceReserveTask

ResourceReserveTask is tasks.ResourceReserveTask.

type ResourceSelector

type ResourceSelector = tasks.ResourceSelector

ResourceSelector is tasks.ResourceSelector.

func ParseResourceSelectors

func ParseResourceSelectors(addresses []string) ([]ResourceSelector, error)

ParseResourceSelectors parses addresses for ExportOptions.Resources. Each must name a registered, exportable task type and only keys it declares.

type SchedulerDockerLocalPropertyTask

type SchedulerDockerLocalPropertyTask = tasks.SchedulerDockerLocalPropertyTask

SchedulerDockerLocalPropertyTask is tasks.SchedulerDockerLocalPropertyTask.

type SchedulerK3sAnnotationsTask

type SchedulerK3sAnnotationsTask = tasks.SchedulerK3sAnnotationsTask

SchedulerK3sAnnotationsTask is tasks.SchedulerK3sAnnotationsTask.

type SchedulerK3sAutoscalingAuthTask

type SchedulerK3sAutoscalingAuthTask = tasks.SchedulerK3sAutoscalingAuthTask

SchedulerK3sAutoscalingAuthTask is tasks.SchedulerK3sAutoscalingAuthTask.

type SchedulerK3sChartTask

type SchedulerK3sChartTask = tasks.SchedulerK3sChartTask

SchedulerK3sChartTask is tasks.SchedulerK3sChartTask.

type SchedulerK3sLabelsTask

type SchedulerK3sLabelsTask = tasks.SchedulerK3sLabelsTask

SchedulerK3sLabelsTask is tasks.SchedulerK3sLabelsTask.

type SchedulerK3sNodeSysctlsTask

type SchedulerK3sNodeSysctlsTask = tasks.SchedulerK3sNodeSysctlsTask

SchedulerK3sNodeSysctlsTask is tasks.SchedulerK3sNodeSysctlsTask.

type SchedulerK3sProfileTask

type SchedulerK3sProfileTask = tasks.SchedulerK3sProfileTask

SchedulerK3sProfileTask is tasks.SchedulerK3sProfileTask.

type SchedulerK3sPropertyTask

type SchedulerK3sPropertyTask = tasks.SchedulerK3sPropertyTask

SchedulerK3sPropertyTask is tasks.SchedulerK3sPropertyTask.

type SchedulerPropertyTask

type SchedulerPropertyTask = tasks.SchedulerPropertyTask

SchedulerPropertyTask is tasks.SchedulerPropertyTask.

type ServiceBackupTask

type ServiceBackupTask = tasks.ServiceBackupTask

ServiceBackupTask is tasks.ServiceBackupTask.

type ServiceCreateTask

type ServiceCreateTask = tasks.ServiceCreateTask

ServiceCreateTask is tasks.ServiceCreateTask.

type ServiceExposeTask

type ServiceExposeTask = tasks.ServiceExposeTask

ServiceExposeTask is tasks.ServiceExposeTask.

type ServiceLinkTask

type ServiceLinkTask = tasks.ServiceLinkTask

ServiceLinkTask is tasks.ServiceLinkTask.

type ServicePropertyTask

type ServicePropertyTask = tasks.ServicePropertyTask

ServicePropertyTask is tasks.ServicePropertyTask.

type Session

type Session = subprocess.Session

Session is subprocess.Session.

func NewSession

func NewSession(masker *Masker) *Session

NewSession returns a session whose contexts carry masker. A nil masker leaves any masker already on the parent context in place.

Example

A session installs the masker and target a run needs, and closes the SSH connections made under it.

package main

import (
	"context"

	"github.com/dokku/docket/sdk"
)

func main() {
	session := sdk.NewSession(sdk.NewMasker("s3cr3t"))
	defer func() { _ = session.Close() }()

	ctx := session.Context(context.Background(), sdk.Target{
		Host: "deploy@dokku.example.com",
		Sudo: true,
	})
	_ = ctx
}

type SshKeyTask

type SshKeyTask = tasks.SshKeyTask

SshKeyTask is tasks.SshKeyTask.

type State

type State = tasks.State

State is tasks.State.

type StorageEnsureTask

type StorageEnsureTask = tasks.StorageEnsureTask

StorageEnsureTask is tasks.StorageEnsureTask.

type StorageEntryTask

type StorageEntryTask = tasks.StorageEntryTask

StorageEntryTask is tasks.StorageEntryTask.

type StorageMount

type StorageMount = tasks.StorageMount

StorageMount is tasks.StorageMount.

type StorageMountTask

type StorageMountTask = tasks.StorageMountTask

StorageMountTask is tasks.StorageMountTask.

type Target

type Target = subprocess.Target

Target is subprocess.Target.

type Task

type Task = tasks.Task

Task is tasks.Task.

func DecodeTask

func DecodeTask(typeKey string, body []byte) (Task, error)

DecodeTask builds a task of the registered type typeKey from a YAML task body, with defaults applied.

func Lookup

func Lookup(typeKey string) (Task, bool)

Lookup reports whether typeKey is a registered task type and, when it is, returns a new zero-value instance of it for reading metadata. It has no defaults applied; use NewTask for a task to run.

func NewTask

func NewTask(typeKey string) (Task, error)

NewTask returns a new task of the registered type typeKey, such as "dokku_app", with its `default:` values applied. Use it rather than a struct literal, which leaves State as "" instead of the default the field documents.

The task is a pointer to the registered type, so fields are set through a type assertion:

task, err := sdk.NewTask("dokku_app")
app := task.(*sdk.AppTask)
app.App = "api"
Example
package main

import (
	"fmt"

	"github.com/dokku/docket/sdk"
)

func main() {
	task, err := sdk.NewTask("dokku_app")
	if err != nil {
		panic(err)
	}
	app := task.(*sdk.AppTask)
	app.App = "api"

	fmt.Println(sdk.IdentityAddress("dokku_app", app), app.State)
}
Output:
dokku_app[app=api] present

type TaskCatalog

type TaskCatalog = tasks.TaskCatalog

TaskCatalog is tasks.TaskCatalog.

func Catalog

func Catalog() (TaskCatalog, error)

Catalog describes every registered task type. It is what `docket schema` emits.

func CatalogFor

func CatalogFor(typeKeys []string) (TaskCatalog, error)

CatalogFor describes only the given task types. An unregistered type is an error.

Example
package main

import (
	"fmt"

	"github.com/dokku/docket/sdk"
)

func main() {
	catalog, err := sdk.CatalogFor([]string{"dokku_app"})
	if err != nil {
		panic(err)
	}
	for _, schema := range catalog.Tasks {
		fmt.Println(schema.Type, "-", schema.Synopsis)
	}
}
Output:
dokku_app - Creates or destroys an app

type TaskOutputState

type TaskOutputState = tasks.TaskOutputState

TaskOutputState is tasks.TaskOutputState.

func ExecutePlan

func ExecutePlan(ctx context.Context, p PlanResult) TaskOutputState

ExecutePlan applies p, the result of a task's Plan, without probing the server again. A plan that is already in sync applies nothing.

type TaskSchema

type TaskSchema = tasks.TaskSchema

TaskSchema is tasks.TaskSchema.

type TraefikPropertyTask

type TraefikPropertyTask = tasks.TraefikPropertyTask

TraefikPropertyTask is tasks.TraefikPropertyTask.

type VersionSupport

type VersionSupport = tasks.VersionSupport

VersionSupport is tasks.VersionSupport.

Jump to

Keyboard shortcuts

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