github.com/rish1988/moby@v25.0.2+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  	AdjustCPUShares  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  	Version   string
    94  }
    95  
    96  // ExecInspect holds information about a running process started
    97  // with docker exec.
    98  type ExecInspect struct {
    99  	ID            string
   100  	Running       bool
   101  	ExitCode      *int
   102  	ProcessConfig *ExecProcessConfig
   103  	OpenStdin     bool
   104  	OpenStderr    bool
   105  	OpenStdout    bool
   106  	CanRemove     bool
   107  	ContainerID   string
   108  	DetachKeys    []byte
   109  	Pid           int
   110  }
   111  
   112  // ExecProcessConfig holds information about the exec process
   113  // running on the host.
   114  type ExecProcessConfig struct {
   115  	Tty        bool     `json:"tty"`
   116  	Entrypoint string   `json:"entrypoint"`
   117  	Arguments  []string `json:"arguments"`
   118  	Privileged *bool    `json:"privileged,omitempty"`
   119  	User       string   `json:"user,omitempty"`
   120  }
   121  
   122  // CreateImageConfig is the configuration for creating an image from a
   123  // container.
   124  type CreateImageConfig struct {
   125  	Tag     reference.NamedTagged
   126  	Pause   bool
   127  	Author  string
   128  	Comment string
   129  	Config  *container.Config
   130  	Changes []string
   131  }
   132  
   133  // GetImageOpts holds parameters to retrieve image information
   134  // from the backend.
   135  type GetImageOpts struct {
   136  	Platform *ocispec.Platform
   137  	Details  bool
   138  }
   139  
   140  // CommitConfig is the configuration for creating an image as part of a build.
   141  type CommitConfig struct {
   142  	Author              string
   143  	Comment             string
   144  	Config              *container.Config
   145  	ContainerConfig     *container.Config
   146  	ContainerID         string
   147  	ContainerMountLabel string
   148  	ContainerOS         string
   149  	ParentImageID       string
   150  }
   151  
   152  // PluginRmConfig holds arguments for plugin remove.
   153  type PluginRmConfig struct {
   154  	ForceRemove bool
   155  }
   156  
   157  // PluginEnableConfig holds arguments for plugin enable
   158  type PluginEnableConfig struct {
   159  	Timeout int
   160  }
   161  
   162  // PluginDisableConfig holds arguments for plugin disable.
   163  type PluginDisableConfig struct {
   164  	ForceDisable bool
   165  }
   166  
   167  // NetworkListConfig stores the options available for listing networks
   168  type NetworkListConfig struct {
   169  	// TODO(@cpuguy83): naming is hard, this is pulled from what was being used in the router before moving here
   170  	Detailed bool
   171  	Verbose  bool
   172  }