github.com/walkingsparrow/docker@v1.4.2-0.20151218153551-b708a2249bfa/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/filters" 9 "github.com/docker/docker/pkg/ulimit" 10 "github.com/docker/docker/runconfig" 11 ) 12 13 // ContainerAttachOptions holds parameters to attach to a container. 14 type ContainerAttachOptions struct { 15 ContainerID string 16 Stream bool 17 Stdin bool 18 Stdout bool 19 Stderr bool 20 } 21 22 // ContainerCommitOptions holds parameters to commit changes into a container. 23 type ContainerCommitOptions struct { 24 ContainerID string 25 RepositoryName string 26 Tag string 27 Comment string 28 Author string 29 Changes []string 30 Pause bool 31 Config *runconfig.Config 32 } 33 34 // ContainerExecInspect holds information returned by exec inspect. 35 type ContainerExecInspect struct { 36 ExecID string 37 ContainerID string 38 Running bool 39 ExitCode int 40 } 41 42 // ContainerListOptions holds parameters to list containers with. 43 type ContainerListOptions struct { 44 Quiet bool 45 Size bool 46 All bool 47 Latest bool 48 Since string 49 Before string 50 Limit int 51 Filter filters.Args 52 } 53 54 // ContainerLogsOptions holds parameters to filter logs with. 55 type ContainerLogsOptions struct { 56 ContainerID string 57 ShowStdout bool 58 ShowStderr bool 59 Since string 60 Timestamps bool 61 Follow bool 62 Tail string 63 } 64 65 // ContainerRemoveOptions holds parameters to remove containers. 66 type ContainerRemoveOptions struct { 67 ContainerID string 68 RemoveVolumes bool 69 RemoveLinks bool 70 Force bool 71 } 72 73 // CopyToContainerOptions holds information 74 // about files to copy into a container 75 type CopyToContainerOptions struct { 76 ContainerID string 77 Path string 78 Content io.Reader 79 AllowOverwriteDirWithFile bool 80 } 81 82 // EventsOptions hold parameters to filter events with. 83 type EventsOptions struct { 84 Since string 85 Until string 86 Filters filters.Args 87 } 88 89 // HijackedResponse holds connection information for a hijacked request. 90 type HijackedResponse struct { 91 Conn net.Conn 92 Reader *bufio.Reader 93 } 94 95 // Close closes the hijacked connection and reader. 96 func (h *HijackedResponse) Close() { 97 h.Conn.Close() 98 } 99 100 // CloseWriter is an interface that implement structs 101 // that close input streams to prevent from writing. 102 type CloseWriter interface { 103 CloseWrite() error 104 } 105 106 // CloseWrite closes a readWriter for writing. 107 func (h *HijackedResponse) CloseWrite() error { 108 if conn, ok := h.Conn.(CloseWriter); ok { 109 return conn.CloseWrite() 110 } 111 return nil 112 } 113 114 // ImageBuildOptions holds the information 115 // necessary to build images. 116 type ImageBuildOptions struct { 117 Tags []string 118 SuppressOutput bool 119 RemoteContext string 120 NoCache bool 121 Remove bool 122 ForceRemove bool 123 PullParent bool 124 Isolation string 125 CPUSetCPUs string 126 CPUSetMems string 127 CPUShares int64 128 CPUQuota int64 129 CPUPeriod int64 130 Memory int64 131 MemorySwap int64 132 CgroupParent string 133 ShmSize string 134 Dockerfile string 135 Ulimits []*ulimit.Ulimit 136 BuildArgs []string 137 AuthConfigs map[string]AuthConfig 138 Context io.Reader 139 } 140 141 // ImageBuildResponse holds information 142 // returned by a server after building 143 // an image. 144 type ImageBuildResponse struct { 145 Body io.ReadCloser 146 OSType string 147 } 148 149 // ImageCreateOptions holds information to create images. 150 type ImageCreateOptions struct { 151 // Parent is the image to create this image from 152 Parent string 153 // Tag is the name to tag this image 154 Tag string 155 // RegistryAuth is the base64 encoded credentials for this server 156 RegistryAuth string 157 } 158 159 // ImageImportOptions holds information to import images from the client host. 160 type ImageImportOptions struct { 161 // Source is the data to send to the server to create this image from 162 Source io.Reader 163 // Source is the name of the source to import this image from 164 SourceName string 165 // RepositoryName is the name of the repository to import this image 166 RepositoryName string 167 // Message is the message to tag the image with 168 Message string 169 // Tag is the name to tag this image 170 Tag string 171 // Changes are the raw changes to apply to the image 172 Changes []string 173 } 174 175 // ImageListOptions holds parameters to filter the list of images with. 176 type ImageListOptions struct { 177 MatchName string 178 All bool 179 Filters filters.Args 180 } 181 182 // ImagePullOptions holds information to pull images. 183 type ImagePullOptions struct { 184 ImageID string 185 Tag string 186 // RegistryAuth is the base64 encoded credentials for this server 187 RegistryAuth string 188 } 189 190 //ImagePushOptions holds information to push images. 191 type ImagePushOptions ImagePullOptions 192 193 // ImageRemoveOptions holds parameters to remove images. 194 type ImageRemoveOptions struct { 195 ImageID string 196 Force bool 197 PruneChildren bool 198 } 199 200 // ImageSearchOptions holds parameters to search images with. 201 type ImageSearchOptions struct { 202 Term string 203 RegistryAuth string 204 } 205 206 // ImageTagOptions holds parameters to tag an image 207 type ImageTagOptions struct { 208 ImageID string 209 RepositoryName string 210 Tag string 211 Force bool 212 } 213 214 // ResizeOptions holds parameters to resize a tty. 215 // It can be used to resize container ttys and 216 // exec process ttys too. 217 type ResizeOptions struct { 218 ID string 219 Height int 220 Width int 221 } 222 223 // VersionResponse holds version information for the client and the server 224 type VersionResponse struct { 225 Client *Version 226 Server *Version 227 } 228 229 // ServerOK return true when the client could connect to the docker server 230 // and parse the information received. It returns false otherwise. 231 func (v VersionResponse) ServerOK() bool { 232 return v.Server != nil 233 }