github.com/a4a881d4/docker@v1.9.0-rc2/api/types/types.go (about)

     1  package types
     2  
     3  import (
     4  	"os"
     5  	"time"
     6  
     7  	"github.com/docker/docker/daemon/network"
     8  	"github.com/docker/docker/pkg/version"
     9  	"github.com/docker/docker/registry"
    10  	"github.com/docker/docker/runconfig"
    11  )
    12  
    13  // ContainerCreateResponse contains the information returned to a client on the
    14  // creation of a new container.
    15  type ContainerCreateResponse struct {
    16  	// ID is the ID of the created container.
    17  	ID string `json:"Id"`
    18  
    19  	// Warnings are any warnings encountered during the creation of the container.
    20  	Warnings []string `json:"Warnings"`
    21  }
    22  
    23  // ContainerExecCreateResponse contains response of Remote API:
    24  // POST "/containers/{name:.*}/exec"
    25  type ContainerExecCreateResponse struct {
    26  	// ID is the exec ID.
    27  	ID string `json:"Id"`
    28  }
    29  
    30  // AuthResponse contains response of Remote API:
    31  // POST "/auth"
    32  type AuthResponse struct {
    33  	// Status is the authentication status
    34  	Status string `json:"Status"`
    35  }
    36  
    37  // ContainerWaitResponse contains response of Remote API:
    38  // POST "/containers/"+containerID+"/wait"
    39  type ContainerWaitResponse struct {
    40  	// StatusCode is the status code of the wait job
    41  	StatusCode int `json:"StatusCode"`
    42  }
    43  
    44  // ContainerCommitResponse contains response of Remote API:
    45  // POST "/commit?container="+containerID
    46  type ContainerCommitResponse struct {
    47  	ID string `json:"Id"`
    48  }
    49  
    50  // ContainerChange contains response of Remote API:
    51  // GET "/containers/{name:.*}/changes"
    52  type ContainerChange struct {
    53  	Kind int
    54  	Path string
    55  }
    56  
    57  // ImageHistory contains response of Remote API:
    58  // GET "/images/{name:.*}/history"
    59  type ImageHistory struct {
    60  	ID        string `json:"Id"`
    61  	Created   int64
    62  	CreatedBy string
    63  	Tags      []string
    64  	Size      int64
    65  	Comment   string
    66  }
    67  
    68  // ImageDelete contains response of Remote API:
    69  // DELETE "/images/{name:.*}"
    70  type ImageDelete struct {
    71  	Untagged string `json:",omitempty"`
    72  	Deleted  string `json:",omitempty"`
    73  }
    74  
    75  // Image contains response of Remote API:
    76  // GET "/images/json"
    77  type Image struct {
    78  	ID          string `json:"Id"`
    79  	ParentID    string `json:"ParentId"`
    80  	RepoTags    []string
    81  	RepoDigests []string
    82  	Created     int64
    83  	Size        int64
    84  	VirtualSize int64
    85  	Labels      map[string]string
    86  }
    87  
    88  // GraphDriverData returns Image's graph driver config info
    89  // when calling inspect command
    90  type GraphDriverData struct {
    91  	Name string
    92  	Data map[string]string
    93  }
    94  
    95  // ImageInspect contains response of Remote API:
    96  // GET "/images/{name:.*}/json"
    97  type ImageInspect struct {
    98  	ID              string `json:"Id"`
    99  	RepoTags        []string
   100  	RepoDigests     []string
   101  	Parent          string
   102  	Comment         string
   103  	Created         string
   104  	Container       string
   105  	ContainerConfig *runconfig.Config
   106  	DockerVersion   string
   107  	Author          string
   108  	Config          *runconfig.Config
   109  	Architecture    string
   110  	Os              string
   111  	Size            int64
   112  	VirtualSize     int64
   113  	GraphDriver     GraphDriverData
   114  }
   115  
   116  // Port stores open ports info of container
   117  // e.g. {"PrivatePort": 8080, "PublicPort": 80, "Type": "tcp"}
   118  type Port struct {
   119  	IP          string `json:",omitempty"`
   120  	PrivatePort int
   121  	PublicPort  int `json:",omitempty"`
   122  	Type        string
   123  }
   124  
   125  // Container contains response of Remote API:
   126  // GET  "/containers/json"
   127  type Container struct {
   128  	ID         string `json:"Id"`
   129  	Names      []string
   130  	Image      string
   131  	ImageID    string
   132  	Command    string
   133  	Created    int64
   134  	Ports      []Port
   135  	SizeRw     int64 `json:",omitempty"`
   136  	SizeRootFs int64 `json:",omitempty"`
   137  	Labels     map[string]string
   138  	Status     string
   139  	HostConfig struct {
   140  		NetworkMode string `json:",omitempty"`
   141  	}
   142  }
   143  
   144  // CopyConfig contains request body of Remote API:
   145  // POST "/containers/"+containerID+"/copy"
   146  type CopyConfig struct {
   147  	Resource string
   148  }
   149  
   150  // ContainerPathStat is used to encode the header from
   151  // GET "/containers/{name:.*}/archive"
   152  // "Name" is the file or directory name.
   153  type ContainerPathStat struct {
   154  	Name       string      `json:"name"`
   155  	Size       int64       `json:"size"`
   156  	Mode       os.FileMode `json:"mode"`
   157  	Mtime      time.Time   `json:"mtime"`
   158  	LinkTarget string      `json:"linkTarget"`
   159  }
   160  
   161  // ContainerProcessList contains response of Remote API:
   162  // GET "/containers/{name:.*}/top"
   163  type ContainerProcessList struct {
   164  	Processes [][]string
   165  	Titles    []string
   166  }
   167  
   168  // Version contains response of Remote API:
   169  // GET "/version"
   170  type Version struct {
   171  	Version       string
   172  	APIVersion    version.Version `json:"ApiVersion"`
   173  	GitCommit     string
   174  	GoVersion     string
   175  	Os            string
   176  	Arch          string
   177  	KernelVersion string `json:",omitempty"`
   178  	Experimental  bool   `json:",omitempty"`
   179  	BuildTime     string `json:",omitempty"`
   180  }
   181  
   182  // Info contains response of Remote API:
   183  // GET "/info"
   184  type Info struct {
   185  	ID                 string
   186  	Containers         int
   187  	Images             int
   188  	Driver             string
   189  	DriverStatus       [][2]string
   190  	MemoryLimit        bool
   191  	SwapLimit          bool
   192  	CPUCfsPeriod       bool `json:"CpuCfsPeriod"`
   193  	CPUCfsQuota        bool `json:"CpuCfsQuota"`
   194  	IPv4Forwarding     bool
   195  	BridgeNfIptables   bool
   196  	BridgeNfIP6tables  bool `json:"BridgeNfIp6tables"`
   197  	Debug              bool
   198  	NFd                int
   199  	OomKillDisable     bool
   200  	NGoroutines        int
   201  	SystemTime         string
   202  	ExecutionDriver    string
   203  	LoggingDriver      string
   204  	NEventsListener    int
   205  	KernelVersion      string
   206  	OperatingSystem    string
   207  	IndexServerAddress string
   208  	RegistryConfig     *registry.ServiceConfig
   209  	InitSha1           string
   210  	InitPath           string
   211  	NCPU               int
   212  	MemTotal           int64
   213  	DockerRootDir      string
   214  	HTTPProxy          string `json:"HttpProxy"`
   215  	HTTPSProxy         string `json:"HttpsProxy"`
   216  	NoProxy            string
   217  	Name               string
   218  	Labels             []string
   219  	ExperimentalBuild  bool
   220  	ServerVersion      string
   221  	ClusterStore       string
   222  }
   223  
   224  // ExecStartCheck is a temp struct used by execStart
   225  // Config fields is part of ExecConfig in runconfig package
   226  type ExecStartCheck struct {
   227  	// ExecStart will first check if it's detached
   228  	Detach bool
   229  	// Check if there's a tty
   230  	Tty bool
   231  }
   232  
   233  // ContainerState stores container's running state
   234  // it's part of ContainerJSONBase and will return by "inspect" command
   235  type ContainerState struct {
   236  	Status     string
   237  	Running    bool
   238  	Paused     bool
   239  	Restarting bool
   240  	OOMKilled  bool
   241  	Dead       bool
   242  	Pid        int
   243  	ExitCode   int
   244  	Error      string
   245  	StartedAt  string
   246  	FinishedAt string
   247  }
   248  
   249  // ContainerJSONBase contains response of Remote API:
   250  // GET "/containers/{name:.*}/json"
   251  type ContainerJSONBase struct {
   252  	ID              string `json:"Id"`
   253  	Created         string
   254  	Path            string
   255  	Args            []string
   256  	State           *ContainerState
   257  	Image           string
   258  	NetworkSettings *network.Settings
   259  	ResolvConfPath  string
   260  	HostnamePath    string
   261  	HostsPath       string
   262  	LogPath         string
   263  	Name            string
   264  	RestartCount    int
   265  	Driver          string
   266  	ExecDriver      string
   267  	MountLabel      string
   268  	ProcessLabel    string
   269  	AppArmorProfile string
   270  	ExecIDs         []string
   271  	HostConfig      *runconfig.HostConfig
   272  	GraphDriver     GraphDriverData
   273  	SizeRw          *int64 `json:",omitempty"`
   274  	SizeRootFs      *int64 `json:",omitempty"`
   275  }
   276  
   277  // ContainerJSON is newly used struct along with MountPoint
   278  type ContainerJSON struct {
   279  	*ContainerJSONBase
   280  	Mounts []MountPoint
   281  	Config *runconfig.Config
   282  }
   283  
   284  // MountPoint represents a mount point configuration inside the container.
   285  type MountPoint struct {
   286  	Name        string `json:",omitempty"`
   287  	Source      string
   288  	Destination string
   289  	Driver      string `json:",omitempty"`
   290  	Mode        string
   291  	RW          bool
   292  }
   293  
   294  // Volume represents the configuration of a volume for the remote API
   295  type Volume struct {
   296  	Name       string // Name is the name of the volume
   297  	Driver     string // Driver is the Driver name used to create the volume
   298  	Mountpoint string // Mountpoint is the location on disk of the volume
   299  }
   300  
   301  // VolumesListResponse contains the response for the remote API:
   302  // GET "/volumes"
   303  type VolumesListResponse struct {
   304  	Volumes []*Volume // Volumes is the list of volumes being returned
   305  }
   306  
   307  // VolumeCreateRequest contains the response for the remote API:
   308  // POST "/volumes/create"
   309  type VolumeCreateRequest struct {
   310  	Name       string            // Name is the requested name of the volume
   311  	Driver     string            // Driver is the name of the driver that should be used to create the volume
   312  	DriverOpts map[string]string // DriverOpts holds the driver specific options to use for when creating the volume.
   313  }
   314  
   315  // NetworkResource is the body of the "get network" http response message
   316  type NetworkResource struct {
   317  	Name       string                      `json:"name"`
   318  	ID         string                      `json:"id"`
   319  	Scope      string                      `json:"scope"`
   320  	Driver     string                      `json:"driver"`
   321  	IPAM       network.IPAM                `json:"ipam"`
   322  	Containers map[string]EndpointResource `json:"containers"`
   323  	Options    map[string]string           `json:"options"`
   324  }
   325  
   326  //EndpointResource contains network resources allocated and usd for a container in a network
   327  type EndpointResource struct {
   328  	EndpointID  string `json:"endpoint"`
   329  	MacAddress  string `json:"mac_address"`
   330  	IPv4Address string `json:"ipv4_address"`
   331  	IPv6Address string `json:"ipv6_address"`
   332  }
   333  
   334  // NetworkCreate is the expected body of the "create network" http request message
   335  type NetworkCreate struct {
   336  	Name           string            `json:"name"`
   337  	CheckDuplicate bool              `json:"check_duplicate"`
   338  	Driver         string            `json:"driver"`
   339  	IPAM           network.IPAM      `json:"ipam"`
   340  	Options        map[string]string `json:"options"`
   341  }
   342  
   343  // NetworkCreateResponse is the response message sent by the server for network create call
   344  type NetworkCreateResponse struct {
   345  	ID      string `json:"id"`
   346  	Warning string `json:"warning"`
   347  }
   348  
   349  // NetworkConnect represents the data to be used to connect a container to the network
   350  type NetworkConnect struct {
   351  	Container string `json:"container"`
   352  }
   353  
   354  // NetworkDisconnect represents the data to be used to disconnect a container from the network
   355  type NetworkDisconnect struct {
   356  	Container string `json:"container"`
   357  }