github.com/moby/docker@v26.1.3+incompatible/api/types/backend/backend.go (about)

     1  // Package backend includes types to send information to server backends.
     2  package backend // import "github.com/docker/docker/api/types/backend"
     3  
     4  import (
     5  	"io"
     6  	"time"
     7  
     8  	"github.com/distribution/reference"
     9  	"github.com/docker/docker/api/types/container"
    10  	"github.com/docker/docker/api/types/network"
    11  	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
    12  )
    13  
    14  // ContainerCreateConfig is the parameter set to ContainerCreate()
    15  type ContainerCreateConfig struct {
    16  	Name                        string
    17  	Config                      *container.Config
    18  	HostConfig                  *container.HostConfig
    19  	NetworkingConfig            *network.NetworkingConfig
    20  	Platform                    *ocispec.Platform
    21  	DefaultReadOnlyNonRecursive bool
    22  }
    23  
    24  // ContainerRmConfig holds arguments for the container remove
    25  // operation. This struct is used to tell the backend what operations
    26  // to perform.
    27  type ContainerRmConfig struct {
    28  	ForceRemove, RemoveVolume, RemoveLink bool
    29  }
    30  
    31  // ContainerAttachConfig holds the streams to use when connecting to a container to view logs.
    32  type ContainerAttachConfig struct {
    33  	GetStreams func(multiplexed bool) (io.ReadCloser, io.Writer, io.Writer, error)
    34  	UseStdin   bool
    35  	UseStdout  bool
    36  	UseStderr  bool
    37  	Logs       bool
    38  	Stream     bool
    39  	DetachKeys string
    40  	// Used to signify that streams must be multiplexed by producer as endpoint can't manage multiple streams.
    41  	// This is typically set by HTTP endpoint, while websocket can transport raw streams
    42  	MuxStreams bool
    43  }
    44  
    45  // PartialLogMetaData provides meta data for a partial log message. Messages
    46  // exceeding a predefined size are split into chunks with this metadata. The
    47  // expectation is for the logger endpoints to assemble the chunks using this
    48  // metadata.
    49  type PartialLogMetaData struct {
    50  	Last    bool   // true if this message is last of a partial
    51  	ID      string // identifies group of messages comprising a single record
    52  	Ordinal int    // ordering of message in partial group
    53  }
    54  
    55  // LogMessage is datastructure that represents piece of output produced by some
    56  // container.  The Line member is a slice of an array whose contents can be
    57  // changed after a log driver's Log() method returns.
    58  type LogMessage struct {
    59  	Line         []byte
    60  	Source       string
    61  	Timestamp    time.Time
    62  	Attrs        []LogAttr
    63  	PLogMetaData *PartialLogMetaData
    64  
    65  	// Err is an error associated with a message. Completeness of a message
    66  	// with Err is not expected, tho it may be partially complete (fields may
    67  	// be missing, gibberish, or nil)
    68  	Err error
    69  }
    70  
    71  // LogAttr is used to hold the extra attributes available in the log message.
    72  type LogAttr struct {
    73  	Key   string
    74  	Value string
    75  }
    76  
    77  // LogSelector is a list of services and tasks that should be returned as part
    78  // of a log stream. It is similar to swarmapi.LogSelector, with the difference
    79  // that the names don't have to be resolved to IDs; this is mostly to avoid
    80  // accidents later where a swarmapi LogSelector might have been incorrectly
    81  // used verbatim (and to avoid the handler having to import swarmapi types)
    82  type LogSelector struct {
    83  	Services []string
    84  	Tasks    []string
    85  }
    86  
    87  // ContainerStatsConfig holds information for configuring the runtime
    88  // behavior of a backend.ContainerStats() call.
    89  type ContainerStatsConfig struct {
    90  	Stream    bool
    91  	OneShot   bool
    92  	OutStream io.Writer
    93  }
    94  
    95  // ExecInspect holds information about a running process started
    96  // with docker exec.
    97  type ExecInspect struct {
    98  	ID            string
    99  	Running       bool
   100  	ExitCode      *int
   101  	ProcessConfig *ExecProcessConfig
   102  	OpenStdin     bool
   103  	OpenStderr    bool
   104  	OpenStdout    bool
   105  	CanRemove     bool
   106  	ContainerID   string
   107  	DetachKeys    []byte
   108  	Pid           int
   109  }
   110  
   111  // ExecProcessConfig holds information about the exec process
   112  // running on the host.
   113  type ExecProcessConfig struct {
   114  	Tty        bool     `json:"tty"`
   115  	Entrypoint string   `json:"entrypoint"`
   116  	Arguments  []string `json:"arguments"`
   117  	Privileged *bool    `json:"privileged,omitempty"`
   118  	User       string   `json:"user,omitempty"`
   119  }
   120  
   121  // CreateImageConfig is the configuration for creating an image from a
   122  // container.
   123  type CreateImageConfig struct {
   124  	Tag     reference.NamedTagged
   125  	Pause   bool
   126  	Author  string
   127  	Comment string
   128  	Config  *container.Config
   129  	Changes []string
   130  }
   131  
   132  // GetImageOpts holds parameters to retrieve image information
   133  // from the backend.
   134  type GetImageOpts struct {
   135  	Platform *ocispec.Platform
   136  	Details  bool
   137  }
   138  
   139  // CommitConfig is the configuration for creating an image as part of a build.
   140  type CommitConfig struct {
   141  	Author              string
   142  	Comment             string
   143  	Config              *container.Config
   144  	ContainerConfig     *container.Config
   145  	ContainerID         string
   146  	ContainerMountLabel string
   147  	ContainerOS         string
   148  	ParentImageID       string
   149  }
   150  
   151  // PluginRmConfig holds arguments for plugin remove.
   152  type PluginRmConfig struct {
   153  	ForceRemove bool
   154  }
   155  
   156  // PluginEnableConfig holds arguments for plugin enable
   157  type PluginEnableConfig struct {
   158  	Timeout int
   159  }
   160  
   161  // PluginDisableConfig holds arguments for plugin disable.
   162  type PluginDisableConfig struct {
   163  	ForceDisable bool
   164  }
   165  
   166  // NetworkListConfig stores the options available for listing networks
   167  type NetworkListConfig struct {
   168  	// TODO(@cpuguy83): naming is hard, this is pulled from what was being used in the router before moving here
   169  	Detailed bool
   170  	Verbose  bool
   171  }