swarm

package
v1.17.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const StackNamespaceLabel = "com.docker.stack.namespace"

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigCreateRequest

type ConfigCreateRequest struct {
	Spec json.RawMessage `json:"spec" doc:"Config specification"`
}

type ConfigSummary

type ConfigSummary struct {
	ID        string           `json:"id"`
	Version   swarm.Version    `json:"version"`
	CreatedAt time.Time        `json:"createdAt"`
	UpdatedAt time.Time        `json:"updatedAt"`
	Spec      swarm.ConfigSpec `json:"spec"`
}

func NewConfigSummary

func NewConfigSummary(cfg swarm.Config) ConfigSummary

NewConfigSummary converts a Docker swarm config into the API-facing ConfigSummary shape.

It copies the config identity, version, timestamps, and spec from the Docker SDK type without modifying the source value.

cfg is the Docker swarm config to summarize.

Returns the serialized config summary used by the API.

type ConfigUpdateRequest

type ConfigUpdateRequest struct {
	Version uint64          `json:"version,omitempty"`
	Spec    json.RawMessage `json:"spec" doc:"Updated config specification"`
}

type NodeAgentState

type NodeAgentState string
const (
	NodeAgentStateNone       NodeAgentState = "none"
	NodeAgentStatePending    NodeAgentState = "pending"
	NodeAgentStateOffline    NodeAgentState = "offline"
	NodeAgentStateConnected  NodeAgentState = "connected"
	NodeAgentStateMismatched NodeAgentState = "mismatched"
)

type NodeAgentStatus

type NodeAgentStatus struct {
	State            NodeAgentState `json:"state"`
	EnvironmentID    *string        `json:"environmentId,omitempty"`
	Connected        *bool          `json:"connected,omitempty"`
	LastHeartbeat    *time.Time     `json:"lastHeartbeat,omitempty"`
	LastPollAt       *time.Time     `json:"lastPollAt,omitempty"`
	ReportedNodeID   *string        `json:"reportedNodeId,omitempty"`
	ReportedHostname *string        `json:"reportedHostname,omitempty"`
}

type NodeSummary

type NodeSummary struct {
	// ID is the unique identifier of the node.
	//
	// Required: true
	ID string `json:"id"`

	// Hostname is the node hostname.
	//
	// Required: true
	Hostname string `json:"hostname"`

	// Role indicates whether the node is a manager or worker.
	//
	// Required: true
	Role string `json:"role"`

	// Availability indicates if the node is active, paused, or drained.
	//
	// Required: true
	Availability string `json:"availability"`

	// Status is the node readiness state.
	//
	// Required: true
	Status string `json:"status"`

	// Address is the node address.
	//
	// Required: false
	Address string `json:"address,omitempty"`

	// ManagerStatus is the manager status string if applicable.
	//
	// Required: false
	ManagerStatus string `json:"managerStatus,omitempty"`

	// Reachability is the manager reachability if applicable.
	//
	// Required: false
	Reachability string `json:"reachability,omitempty"`

	// Labels contains node labels.
	//
	// Required: false
	Labels map[string]string `json:"labels,omitempty"`

	// EngineVersion is the Docker engine version.
	//
	// Required: false
	EngineVersion string `json:"engineVersion,omitempty"`

	// Platform is the node platform string.
	//
	// Required: false
	Platform string `json:"platform,omitempty"`

	// CreatedAt is when the node was created.
	//
	// Required: true
	CreatedAt time.Time `json:"createdAt"`

	// UpdatedAt is when the node was last updated.
	//
	// Required: true
	UpdatedAt time.Time `json:"updatedAt"`

	// Agent describes Arcane node-agent coverage for this swarm node.
	//
	// Required: true
	Agent NodeAgentStatus `json:"agent"`
}

func NewNodeSummary

func NewNodeSummary(node swarm.Node) NodeSummary

NewNodeSummary converts a Docker swarm node into the API-facing NodeSummary shape.

It derives manager role labels, reachability, platform strings, and default node-agent state from the Docker SDK value so callers can return a stable, JSON-friendly representation.

node is the Docker swarm node to summarize.

Returns a NodeSummary populated from node.

type NodeUpdateRequest

type NodeUpdateRequest struct {
	// Version is the node version index to update.
	//
	// Required: false
	Version uint64 `json:"version,omitempty"`

	// Name overrides the node name annotation.
	//
	// Required: false
	Name *string `json:"name,omitempty"`

	// Labels updates node labels.
	//
	// Required: false
	Labels map[string]string `json:"labels,omitempty"`

	// Role updates node role (manager or worker).
	//
	// Required: false
	Role *swarm.NodeRole `json:"role,omitempty"`

	// Availability updates node availability (active, pause, drain).
	//
	// Required: false
	Availability *swarm.NodeAvailability `json:"availability,omitempty"`
}

type RuntimeStatus

type RuntimeStatus struct {
	Enabled bool `json:"enabled"`
}

type SecretCreateRequest

type SecretCreateRequest struct {
	Spec json.RawMessage `json:"spec" doc:"Secret specification"`
}

type SecretSummary

type SecretSummary struct {
	ID        string           `json:"id"`
	Version   swarm.Version    `json:"version"`
	CreatedAt time.Time        `json:"createdAt"`
	UpdatedAt time.Time        `json:"updatedAt"`
	Spec      swarm.SecretSpec `json:"spec"`
}

func NewSecretSummary

func NewSecretSummary(secret swarm.Secret) SecretSummary

NewSecretSummary converts a Docker swarm secret into the API-facing SecretSummary shape.

It copies the secret identity, version, timestamps, and spec from the Docker SDK type without modifying the source value.

secret is the Docker swarm secret to summarize.

Returns the serialized secret summary used by the API.

type SecretUpdateRequest

type SecretUpdateRequest struct {
	Version uint64          `json:"version,omitempty"`
	Spec    json.RawMessage `json:"spec" doc:"Updated secret specification"`
}

type ServiceCreateOptions

type ServiceCreateOptions struct {
	// EncodedRegistryAuth is the encoded registry authorization credentials.
	//
	// Required: false
	EncodedRegistryAuth string `json:"encodedRegistryAuth,omitempty"`

	// QueryRegistry indicates if registry metadata should be queried.
	//
	// Required: false
	QueryRegistry bool `json:"queryRegistry,omitempty"`
}

type ServiceCreateRequest

type ServiceCreateRequest struct {
	// Spec is the service specification as a JSON object.
	//
	// Required: true
	Spec json.RawMessage `json:"spec" doc:"Service specification"`

	// Options are additional create options for the service.
	//
	// Required: false
	Options *ServiceCreateOptions `json:"options,omitempty" doc:"Additional create options"`
}

type ServiceCreateResponse

type ServiceCreateResponse struct {
	// ID is the created service ID.
	//
	// Required: true
	ID string `json:"id"`

	// Warnings are any warnings returned by the Docker API.
	//
	// Required: false
	Warnings []string `json:"warnings,omitempty"`
}

type ServiceInspect

type ServiceInspect struct {
	// ID is the unique identifier of the service.
	//
	// Required: true
	ID string `json:"id"`

	// Version is the service version metadata.
	//
	// Required: true
	Version swarm.Version `json:"version"`

	// CreatedAt is the time when the service was created.
	//
	// Required: true
	CreatedAt time.Time `json:"createdAt"`

	// UpdatedAt is the time when the service was last updated.
	//
	// Required: true
	UpdatedAt time.Time `json:"updatedAt"`

	// Spec is the full service specification.
	//
	// Required: true
	Spec swarm.ServiceSpec `json:"spec"`

	// Endpoint is the service endpoint configuration.
	//
	// Required: true
	Endpoint swarm.Endpoint `json:"endpoint"`

	// UpdateStatus is the current update status, if any.
	UpdateStatus *swarm.UpdateStatus `json:"updateStatus,omitempty"`

	// Nodes is a list of node hostnames running this service.
	Nodes []string `json:"nodes,omitempty"`

	// NetworkDetails contains enriched network information keyed by network ID.
	NetworkDetails map[string]ServiceNetworkDetail `json:"networkDetails,omitempty"`

	// Mounts contains enriched mount information with volume driver details.
	Mounts []ServiceMount `json:"mounts,omitempty"`
}

func NewServiceInspect

func NewServiceInspect(service swarm.Service) ServiceInspect

NewServiceInspect converts a Docker swarm service into the API-facing ServiceInspect shape.

It copies the core inspection fields directly from the Docker SDK type. Callers can enrich the returned value with node, network, or mount details after construction when needed.

service is the Docker swarm service to convert.

Returns the base inspection payload for service.

type ServiceMount

type ServiceMount struct {
	// Type of the mount (bind, volume, tmpfs, npipe, cluster).
	Type string `json:"type"`

	// Source is the host path or volume name.
	Source string `json:"source,omitempty"`

	// Target is the container-internal path.
	Target string `json:"target"`

	// ReadOnly indicates if the mount is read-only.
	ReadOnly bool `json:"readOnly,omitempty"`

	// VolumeDriver is the volume driver name (only for volume mounts).
	VolumeDriver string `json:"volumeDriver,omitempty"`

	// VolumeOptions contains driver-specific options (only for volume mounts).
	VolumeOptions map[string]string `json:"volumeOptions,omitempty"`

	// DevicePath is the host device path for bind-backed volumes (driver_opts type=none, o=bind).
	DevicePath string `json:"devicePath,omitempty"`
}

type ServiceNetworkConfigDetail

type ServiceNetworkConfigDetail struct {
	Name        string                     `json:"name"`
	Driver      string                     `json:"driver"`
	Scope       string                     `json:"scope"`
	EnableIPv4  bool                       `json:"enableIPv4"`
	EnableIPv6  bool                       `json:"enableIPv6"`
	Options     map[string]string          `json:"options,omitempty"`
	IPv4Configs []ServiceNetworkIPAMConfig `json:"ipv4Configs,omitempty"`
	IPv6Configs []ServiceNetworkIPAMConfig `json:"ipv6Configs,omitempty"`
}

ServiceNetworkConfigDetail holds details about a config-only network referenced by configFrom.

type ServiceNetworkDetail

type ServiceNetworkDetail struct {
	ID            string                      `json:"id"`
	Name          string                      `json:"name"`
	Driver        string                      `json:"driver"`
	Scope         string                      `json:"scope"`
	Internal      bool                        `json:"internal"`
	Attachable    bool                        `json:"attachable"`
	Ingress       bool                        `json:"ingress"`
	EnableIPv4    bool                        `json:"enableIPv4"`
	EnableIPv6    bool                        `json:"enableIPv6"`
	ConfigFrom    string                      `json:"configFrom,omitempty"`
	ConfigOnly    bool                        `json:"configOnly"`
	Options       map[string]string           `json:"options,omitempty"`
	IPAMConfigs   []ServiceNetworkIPAMConfig  `json:"ipamConfigs,omitempty"`
	ConfigNetwork *ServiceNetworkConfigDetail `json:"configNetwork,omitempty"`
}

ServiceNetworkDetail holds enriched network information for a service's attached network.

type ServiceNetworkIPAMConfig

type ServiceNetworkIPAMConfig struct {
	Subnet  string `json:"subnet,omitempty"`
	Gateway string `json:"gateway,omitempty"`
	IPRange string `json:"ipRange,omitempty"`
}

ServiceNetworkIPAMConfig represents a single IPAM configuration entry with camelCase JSON tags.

type ServicePort

type ServicePort struct {
	// Protocol is the transport protocol used by the port.
	//
	// Required: true
	Protocol string `json:"protocol"`

	// TargetPort is the port inside the container.
	//
	// Required: true
	TargetPort uint32 `json:"targetPort"`

	// PublishedPort is the port exposed on the host.
	//
	// Required: false
	PublishedPort uint32 `json:"publishedPort,omitempty"`

	// PublishMode is the publish mode used for the port.
	//
	// Required: false
	PublishMode string `json:"publishMode,omitempty"`
}

type ServiceScaleRequest

type ServiceScaleRequest struct {
	// Replicas is the desired replica count.
	//
	// Required: true
	Replicas uint64 `json:"replicas"`
}

type ServiceSummary

type ServiceSummary struct {
	// ID is the unique identifier of the service.
	//
	// Required: true
	ID string `json:"id"`

	// Name is the service name.
	//
	// Required: true
	Name string `json:"name"`

	// Image is the container image used by the service.
	//
	// Required: true
	Image string `json:"image"`

	// Mode is the service mode (replicated or global).
	//
	// Required: true
	Mode string `json:"mode"`

	// Replicas is the desired replica count.
	// For replicated services this comes from the spec.
	// For global services this is the number of eligible nodes (from ServiceStatus.DesiredTasks).
	//
	// Required: true
	Replicas uint64 `json:"replicas"`

	// RunningReplicas is the number of tasks currently in the Running state.
	//
	// Required: true
	RunningReplicas uint64 `json:"runningReplicas"`

	// Ports is the list of published ports for the service.
	//
	// Required: true
	Ports []ServicePort `json:"ports"`

	// CreatedAt is the time when the service was created.
	//
	// Required: true
	CreatedAt time.Time `json:"createdAt"`

	// UpdatedAt is the time when the service was last updated.
	//
	// Required: true
	UpdatedAt time.Time `json:"updatedAt"`

	// Labels contains user-defined metadata for the service.
	//
	// Required: true
	Labels map[string]string `json:"labels"`

	// StackName is the stack namespace if the service belongs to a stack.
	//
	// Required: false
	StackName string `json:"stackName,omitempty"`

	// Nodes is the list of node hostnames running tasks for this service.
	//
	// Required: true
	Nodes []string `json:"nodes"`

	// Networks is the list of network names attached to this service.
	//
	// Required: true
	Networks []string `json:"networks"`

	// Mounts is the list of volume/bind mounts configured on this service.
	//
	// Required: true
	Mounts []ServiceMount `json:"mounts"`
}

func NewServiceSummary

func NewServiceSummary(service swarm.Service, nodeNames []string, networkNameByID map[string]string) ServiceSummary

NewServiceSummary converts a Docker swarm service into the API-facing ServiceSummary shape.

It derives the service mode, replica counts, running task counts, published ports, stack namespace label, attached network names, and container mounts. Network IDs are resolved through networkNameByID when possible, then fall back to the attachment alias or raw target value. A nil nodeNames slice is normalized to an empty slice for stable JSON output.

service is the Docker swarm service to summarize. nodeNames lists the node hostnames currently running tasks for the service. networkNameByID maps attached network IDs to human-readable names.

Returns a ServiceSummary populated from service and the supplied enrichment data.

type ServiceUpdateOptions

type ServiceUpdateOptions struct {
	// EncodedRegistryAuth is the encoded registry authorization credentials.
	//
	// Required: false
	EncodedRegistryAuth string `json:"encodedRegistryAuth,omitempty"`

	// RegistryAuthFrom specifies where to find registry auth credentials.
	//
	// Required: false
	RegistryAuthFrom swarm.RegistryAuthSource `json:"registryAuthFrom,omitempty"`

	// Rollback requests a server-side rollback ("previous" or "none").
	//
	// Required: false
	Rollback string `json:"rollback,omitempty"`

	// QueryRegistry indicates if registry metadata should be queried.
	//
	// Required: false
	QueryRegistry bool `json:"queryRegistry,omitempty"`
}

type ServiceUpdateRequest

type ServiceUpdateRequest struct {
	// Version is the service version index to update.
	//
	// Required: true
	Version uint64 `json:"version"`

	// Spec is the updated service specification.
	//
	// Required: true
	Spec swarm.ServiceSpec `json:"spec"`

	// Options are additional update options for the service.
	//
	// Required: false
	Options *ServiceUpdateOptions `json:"options,omitempty"`
}

type ServiceUpdateResponse

type ServiceUpdateResponse struct {
	// Warnings are any warnings returned by the Docker API.
	//
	// Required: false
	Warnings []string `json:"warnings,omitempty"`
}

type StackDeployRequest

type StackDeployRequest struct {
	// Name is the stack name (namespace).
	//
	// Required: true
	Name string `json:"name"`

	// ComposeContent is the Docker Compose YAML content.
	//
	// Required: true
	ComposeContent string `json:"composeContent"`

	// EnvContent is the optional environment file content.
	//
	// Required: false
	EnvContent string `json:"envContent,omitempty"`

	// WithRegistryAuth sends registry auth details to Swarm agents.
	//
	// Required: false
	WithRegistryAuth bool `json:"withRegistryAuth,omitempty"`

	// Prune removes services that are no longer referenced in the stack.
	//
	// Required: false
	Prune bool `json:"prune,omitempty"`

	// ResolveImage controls how image digests are resolved (always, changed, never).
	//
	// Required: false
	ResolveImage string `json:"resolveImage,omitempty"`
}

StackDeployRequest is used to deploy a Swarm stack from a Compose file.

type StackDeployResponse

type StackDeployResponse struct {
	// Name is the deployed stack name.
	//
	// Required: true
	Name string `json:"name"`
}

StackDeployResponse represents the result of a stack deployment.

type StackInspect

type StackInspect struct {
	// Name is the stack name.
	//
	// Required: true
	Name string `json:"name"`

	// Namespace is the stack namespace label value.
	//
	// Required: true
	Namespace string `json:"namespace"`

	// Services is the number of services in the stack.
	//
	// Required: true
	Services int `json:"services"`

	// CreatedAt is the earliest service creation time in the stack.
	//
	// Required: true
	CreatedAt time.Time `json:"createdAt"`

	// UpdatedAt is the latest service update time in the stack.
	//
	// Required: true
	UpdatedAt time.Time `json:"updatedAt"`
}

type StackRenderConfigRequest

type StackRenderConfigRequest struct {
	// Name is the stack name (namespace).
	//
	// Required: true
	Name string `json:"name"`

	// ComposeContent is the Docker Compose YAML content.
	//
	// Required: true
	ComposeContent string `json:"composeContent"`

	// EnvContent is the optional environment file content.
	//
	// Required: false
	EnvContent string `json:"envContent,omitempty"`
}

type StackRenderConfigResponse

type StackRenderConfigResponse struct {
	// Name is the stack name.
	//
	// Required: true
	Name string `json:"name"`

	// RenderedCompose is the normalized compose config output.
	//
	// Required: true
	RenderedCompose string `json:"renderedCompose"`

	// Services contains service names discovered in the compose file.
	//
	// Required: true
	Services []string `json:"services"`

	// Networks contains network names discovered in the compose file.
	//
	// Required: true
	Networks []string `json:"networks"`

	// Volumes contains volume names discovered in the compose file.
	//
	// Required: true
	Volumes []string `json:"volumes"`

	// Configs contains config names discovered in the compose file.
	//
	// Required: true
	Configs []string `json:"configs"`

	// Secrets contains secret names discovered in the compose file.
	//
	// Required: true
	Secrets []string `json:"secrets"`

	// Warnings contains non-fatal warnings.
	//
	// Required: false
	Warnings []string `json:"warnings,omitempty"`
}

type StackSource

type StackSource struct {
	// Name is the stack name.
	//
	// Required: true
	Name string `json:"name"`

	// ComposeContent is the original Docker Compose YAML content used for deployment.
	//
	// Required: true
	ComposeContent string `json:"composeContent"`

	// EnvContent is the optional original environment file content used for deployment.
	//
	// Required: false
	EnvContent string `json:"envContent,omitempty"`
}

type StackSourceUpdateRequest added in v1.17.1

type StackSourceUpdateRequest struct {
	// ComposeContent is the Docker Compose YAML content to persist for the stack.
	//
	// Required: true
	ComposeContent string `json:"composeContent"`

	// EnvContent is the optional environment file content to persist for the stack.
	//
	// Required: false
	EnvContent string `json:"envContent,omitempty"`
}

type StackSummary

type StackSummary struct {
	// ID is the unique identifier for the stack (uses namespace).
	//
	// Required: true
	ID string `json:"id"`

	// Name is the stack name.
	//
	// Required: true
	Name string `json:"name"`

	// Namespace is the stack namespace label value.
	//
	// Required: true
	Namespace string `json:"namespace"`

	// Services is the number of services in the stack.
	//
	// Required: true
	Services int `json:"services"`

	// CreatedAt is the earliest service creation time in the stack.
	//
	// Required: true
	CreatedAt time.Time `json:"createdAt"`

	// UpdatedAt is the latest service update time in the stack.
	//
	// Required: true
	UpdatedAt time.Time `json:"updatedAt"`
}

type SwarmInfo

type SwarmInfo struct {
	// ID is the swarm ID.
	//
	// Required: true
	ID string `json:"id"`

	// CreatedAt is when the swarm was created.
	//
	// Required: true
	CreatedAt time.Time `json:"createdAt"`

	// UpdatedAt is when the swarm was last updated.
	//
	// Required: true
	UpdatedAt time.Time `json:"updatedAt"`

	// Spec is the swarm specification.
	//
	// Required: true
	Spec swarm.Spec `json:"spec"`

	// RootRotationInProgress indicates if a root rotation is in progress.
	//
	// Required: true
	RootRotationInProgress bool `json:"rootRotationInProgress"`
}

func NewSwarmInfo

func NewSwarmInfo(s swarm.Swarm) SwarmInfo

NewSwarmInfo converts a Docker swarm inspection result into the API-facing SwarmInfo shape.

It copies the cluster identifiers, timestamps, spec, and root-rotation state from the Docker SDK type without mutating the source value.

s is the Docker swarm value returned by the Docker client.

Returns the serialized swarm metadata used by the Arcane API.

type SwarmInitRequest

type SwarmInitRequest struct {
	ListenAddr       string                 `json:"listenAddr,omitempty"`
	AdvertiseAddr    string                 `json:"advertiseAddr,omitempty"`
	DataPathAddr     string                 `json:"dataPathAddr,omitempty"`
	DataPathPort     uint32                 `json:"dataPathPort,omitempty"`
	ForceNewCluster  bool                   `json:"forceNewCluster,omitempty"`
	Spec             json.RawMessage        `json:"spec" doc:"Swarm specification"`
	AutoLockManagers bool                   `json:"autoLockManagers,omitempty"`
	Availability     swarm.NodeAvailability `json:"availability,omitempty"`
	DefaultAddrPool  []string               `json:"defaultAddrPool,omitempty"`
	SubnetSize       uint32                 `json:"subnetSize,omitempty"`
}

type SwarmInitResponse

type SwarmInitResponse struct {
	NodeID string `json:"nodeId"`
}

type SwarmJoinRequest

type SwarmJoinRequest struct {
	ListenAddr    string                 `json:"listenAddr,omitempty"`
	AdvertiseAddr string                 `json:"advertiseAddr,omitempty"`
	DataPathAddr  string                 `json:"dataPathAddr,omitempty"`
	RemoteAddrs   []string               `json:"remoteAddrs"`
	JoinToken     string                 `json:"joinToken"`
	Availability  swarm.NodeAvailability `json:"availability,omitempty"`
}

type SwarmJoinTokensResponse

type SwarmJoinTokensResponse struct {
	Worker  string `json:"worker"`
	Manager string `json:"manager"`
}

type SwarmLeaveRequest

type SwarmLeaveRequest struct {
	Force bool `json:"force,omitempty"`
}

type SwarmRotateJoinTokensRequest

type SwarmRotateJoinTokensRequest struct {
	RotateWorkerToken  bool `json:"rotateWorkerToken,omitempty"`
	RotateManagerToken bool `json:"rotateManagerToken,omitempty"`
}

type SwarmUnlockKeyResponse

type SwarmUnlockKeyResponse struct {
	UnlockKey string `json:"unlockKey"`
}

type SwarmUnlockRequest

type SwarmUnlockRequest struct {
	Key string `json:"key"`
}

type SwarmUpdateRequest

type SwarmUpdateRequest struct {
	Version                uint64          `json:"version,omitempty"`
	Spec                   json.RawMessage `json:"spec" doc:"Updated swarm specification"`
	RotateWorkerToken      bool            `json:"rotateWorkerToken,omitempty"`
	RotateManagerToken     bool            `json:"rotateManagerToken,omitempty"`
	RotateManagerUnlockKey bool            `json:"rotateManagerUnlockKey,omitempty"`
}

type TaskSummary

type TaskSummary struct {
	// ID is the unique identifier of the task.
	//
	// Required: true
	ID string `json:"id"`

	// Name is the task name.
	//
	// Required: true
	Name string `json:"name"`

	// ServiceID is the service ID the task belongs to.
	//
	// Required: true
	ServiceID string `json:"serviceId"`

	// ServiceName is the service name the task belongs to.
	//
	// Required: true
	ServiceName string `json:"serviceName"`

	// NodeID is the node ID running the task.
	//
	// Required: true
	NodeID string `json:"nodeId"`

	// NodeName is the node name running the task.
	//
	// Required: true
	NodeName string `json:"nodeName"`

	// DesiredState is the desired state for the task.
	//
	// Required: true
	DesiredState string `json:"desiredState"`

	// CurrentState is the current runtime state for the task.
	//
	// Required: true
	CurrentState string `json:"currentState"`

	// Error is any error message reported by the task.
	//
	// Required: false
	Error string `json:"error,omitempty"`

	// ContainerID is the container ID backing the task.
	//
	// Required: false
	ContainerID string `json:"containerId,omitempty"`

	// Image is the container image used by the task.
	//
	// Required: false
	Image string `json:"image,omitempty"`

	// Slot is the task slot for replicated services.
	//
	// Required: false
	Slot int `json:"slot,omitempty"`

	// CreatedAt is when the task was created.
	//
	// Required: true
	CreatedAt time.Time `json:"createdAt"`

	// UpdatedAt is when the task was last updated.
	//
	// Required: true
	UpdatedAt time.Time `json:"updatedAt"`
}

func NewTaskSummary

func NewTaskSummary(task swarm.Task, serviceName, nodeName string) TaskSummary

NewTaskSummary converts a Docker swarm task into the API-facing TaskSummary shape.

It extracts task identity, service and node names supplied by the caller, container image and container ID details when available, and falls back from the Docker task error field to the task status message when necessary.

task is the Docker swarm task to summarize. serviceName is the human-readable service name associated with task. nodeName is the human-readable node name associated with task.

Returns a TaskSummary populated from task and the supplied display names.

Jump to

Keyboard shortcuts

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