github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/api/types/client.go (about) 1 package types 2 3 import ( 4 "bufio" 5 "io" 6 "net" 7 8 "github.com/docker/docker/api/types/container" 9 "github.com/docker/docker/api/types/filters" 10 "github.com/docker/go-units" 11 ) 12 13 // CheckpointCreateOptions holds parameters to create a checkpoint from a container 14 type CheckpointCreateOptions struct { 15 CheckpointID string 16 Exit bool 17 } 18 19 // ContainerAttachOptions holds parameters to attach to a container. 20 type ContainerAttachOptions struct { 21 Stream bool 22 Stdin bool 23 Stdout bool 24 Stderr bool 25 DetachKeys string 26 } 27 28 // ContainerCommitOptions holds parameters to commit changes into a container. 29 type ContainerCommitOptions struct { 30 Reference string 31 Comment string 32 Author string 33 Changes []string 34 Pause bool 35 Config *container.Config 36 } 37 38 // ContainerExecInspect holds information returned by exec inspect. 39 type ContainerExecInspect struct { 40 ExecID string 41 ContainerID string 42 Running bool 43 ExitCode int 44 } 45 46 // ContainerListOptions holds parameters to list containers with. 47 type ContainerListOptions struct { 48 Quiet bool 49 Size bool 50 All bool 51 Latest bool 52 Since string 53 Before string 54 Limit int 55 Filter filters.Args 56 } 57 58 // ContainerLogsOptions holds parameters to filter logs with. 59 type ContainerLogsOptions struct { 60 ShowStdout bool 61 ShowStderr bool 62 Since string 63 Timestamps bool 64 Follow bool 65 Tail string 66 Details bool 67 } 68 69 // ContainerRemoveOptions holds parameters to remove containers. 70 type ContainerRemoveOptions struct { 71 RemoveVolumes bool 72 RemoveLinks bool 73 Force bool 74 } 75 76 // ContainerStartOptions holds parameters to start containers. 77 type ContainerStartOptions struct { 78 CheckpointID string 79 } 80 81 // CopyToContainerOptions holds information 82 // about files to copy into a container 83 type CopyToContainerOptions struct { 84 AllowOverwriteDirWithFile bool 85 } 86 87 // EventsOptions holds parameters to filter events with. 88 type EventsOptions struct { 89 Since string 90 Until string 91 Filters filters.Args 92 } 93 94 // NetworkListOptions holds parameters to filter the list of networks with. 95 type NetworkListOptions struct { 96 Filters filters.Args 97 } 98 99 // HijackedResponse holds connection information for a hijacked request. 100 type HijackedResponse struct { 101 Conn net.Conn 102 Reader *bufio.Reader 103 } 104 105 // Close closes the hijacked connection and reader. 106 func (h *HijackedResponse) Close() { 107 h.Conn.Close() 108 } 109 110 // CloseWriter is an interface that implements structs 111 // that close input streams to prevent from writing. 112 type CloseWriter interface { 113 CloseWrite() error 114 } 115 116 // CloseWrite closes a readWriter for writing. 117 func (h *HijackedResponse) CloseWrite() error { 118 if conn, ok := h.Conn.(CloseWriter); ok { 119 return conn.CloseWrite() 120 } 121 return nil 122 } 123 124 // ImageBuildOptions holds the information 125 // necessary to build images. 126 type ImageBuildOptions struct { 127 Tags []string 128 SuppressOutput bool 129 RemoteContext string 130 NoCache bool 131 Remove bool 132 ForceRemove bool 133 PullParent bool 134 Isolation container.Isolation 135 CPUSetCPUs string 136 CPUSetMems string 137 CPUShares int64 138 CPUQuota int64 139 CPUPeriod int64 140 Memory int64 141 MemorySwap int64 142 CgroupParent string 143 ShmSize int64 144 Dockerfile string 145 Ulimits []*units.Ulimit 146 BuildArgs map[string]string 147 AuthConfigs map[string]AuthConfig 148 Context io.Reader 149 Labels map[string]string 150 // squash the resulting image's layers to the parent 151 // preserves the original image and creates a new one from the parent with all 152 // the changes applied to a single layer 153 Squash bool 154 // CacheFrom specifies images that are used for matching cache. Images 155 // specified here do not need to have a valid parent chain to match cache. 156 CacheFrom []string 157 } 158 159 // ImageBuildResponse holds information 160 // returned by a server after building 161 // an image. 162 type ImageBuildResponse struct { 163 Body io.ReadCloser 164 OSType string 165 } 166 167 // ImageCreateOptions holds information to create images. 168 type ImageCreateOptions struct { 169 RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry 170 } 171 172 // ImageImportSource holds source information for ImageImport 173 type ImageImportSource struct { 174 Source io.Reader // Source is the data to send to the server to create this image from (mutually exclusive with SourceName) 175 SourceName string // SourceName is the name of the image to pull (mutually exclusive with Source) 176 } 177 178 // ImageImportOptions holds information to import images from the client host. 179 type ImageImportOptions struct { 180 Tag string // Tag is the name to tag this image with. This attribute is deprecated. 181 Message string // Message is the message to tag the image with 182 Changes []string // Changes are the raw changes to apply to this image 183 } 184 185 // ImageListOptions holds parameters to filter the list of images with. 186 type ImageListOptions struct { 187 MatchName string 188 All bool 189 Filters filters.Args 190 } 191 192 // ImageLoadResponse returns information to the client about a load process. 193 type ImageLoadResponse struct { 194 // Body must be closed to avoid a resource leak 195 Body io.ReadCloser 196 JSON bool 197 } 198 199 // ImagePullOptions holds information to pull images. 200 type ImagePullOptions struct { 201 All bool 202 RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry 203 PrivilegeFunc RequestPrivilegeFunc 204 } 205 206 // RequestPrivilegeFunc is a function interface that 207 // clients can supply to retry operations after 208 // getting an authorization error. 209 // This function returns the registry authentication 210 // header value in base 64 format, or an error 211 // if the privilege request fails. 212 type RequestPrivilegeFunc func() (string, error) 213 214 //ImagePushOptions holds information to push images. 215 type ImagePushOptions ImagePullOptions 216 217 // ImageRemoveOptions holds parameters to remove images. 218 type ImageRemoveOptions struct { 219 Force bool 220 PruneChildren bool 221 } 222 223 // ImageSearchOptions holds parameters to search images with. 224 type ImageSearchOptions struct { 225 RegistryAuth string 226 PrivilegeFunc RequestPrivilegeFunc 227 Filters filters.Args 228 Limit int 229 } 230 231 // ResizeOptions holds parameters to resize a tty. 232 // It can be used to resize container ttys and 233 // exec process ttys too. 234 type ResizeOptions struct { 235 Height uint 236 Width uint 237 } 238 239 // VersionResponse holds version information for the client and the server 240 type VersionResponse struct { 241 Client *Version 242 Server *Version 243 } 244 245 // ServerOK returns true when the client could connect to the docker server 246 // and parse the information received. It returns false otherwise. 247 func (v VersionResponse) ServerOK() bool { 248 return v.Server != nil 249 } 250 251 // NodeListOptions holds parameters to list nodes with. 252 type NodeListOptions struct { 253 Filter filters.Args 254 } 255 256 // NodeRemoveOptions holds parameters to remove nodes with. 257 type NodeRemoveOptions struct { 258 Force bool 259 } 260 261 // ServiceCreateOptions contains the options to use when creating a service. 262 type ServiceCreateOptions struct { 263 // EncodedRegistryAuth is the encoded registry authorization credentials to 264 // use when updating the service. 265 // 266 // This field follows the format of the X-Registry-Auth header. 267 EncodedRegistryAuth string 268 } 269 270 // ServiceCreateResponse contains the information returned to a client 271 // on the creation of a new service. 272 type ServiceCreateResponse struct { 273 // ID is the ID of the created service. 274 ID string 275 } 276 277 // ServiceUpdateOptions contains the options to be used for updating services. 278 type ServiceUpdateOptions struct { 279 // EncodedRegistryAuth is the encoded registry authorization credentials to 280 // use when updating the service. 281 // 282 // This field follows the format of the X-Registry-Auth header. 283 EncodedRegistryAuth string 284 285 // TODO(stevvooe): Consider moving the version parameter of ServiceUpdate 286 // into this field. While it does open API users up to racy writes, most 287 // users may not need that level of consistency in practice. 288 } 289 290 // ServiceListOptions holds parameters to list services with. 291 type ServiceListOptions struct { 292 Filter filters.Args 293 } 294 295 // TaskListOptions holds parameters to list tasks with. 296 type TaskListOptions struct { 297 Filter filters.Args 298 } 299 300 // PluginRemoveOptions holds parameters to remove plugins. 301 type PluginRemoveOptions struct { 302 Force bool 303 }