github.com/chenchun/docker@v1.3.2-0.20150629222414-20467faf132b/api/types/types.go (about)

     1  package types
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/docker/docker/daemon/network"
     7  	"github.com/docker/docker/pkg/version"
     8  	"github.com/docker/docker/runconfig"
     9  )
    10  
    11  // ContainerCreateResponse contains the information returned to a client on the
    12  // creation of a new container.
    13  type ContainerCreateResponse struct {
    14  	// ID is the ID of the created container.
    15  	ID string `json:"Id"`
    16  
    17  	// Warnings are any warnings encountered during the creation of the container.
    18  	Warnings []string `json:"Warnings"`
    19  }
    20  
    21  // POST /containers/{name:.*}/exec
    22  type ContainerExecCreateResponse struct {
    23  	// ID is the exec ID.
    24  	ID string `json:"Id"`
    25  }
    26  
    27  // POST /auth
    28  type AuthResponse struct {
    29  	// Status is the authentication status
    30  	Status string `json:"Status"`
    31  }
    32  
    33  // POST "/containers/"+containerID+"/wait"
    34  type ContainerWaitResponse struct {
    35  	// StatusCode is the status code of the wait job
    36  	StatusCode int `json:"StatusCode"`
    37  }
    38  
    39  // POST "/commit?container="+containerID
    40  type ContainerCommitResponse struct {
    41  	ID string `json:"Id"`
    42  }
    43  
    44  // GET "/containers/{name:.*}/changes"
    45  type ContainerChange struct {
    46  	Kind int
    47  	Path string
    48  }
    49  
    50  // GET "/images/{name:.*}/history"
    51  type ImageHistory struct {
    52  	ID        string `json:"Id"`
    53  	Created   int64
    54  	CreatedBy string
    55  	Tags      []string
    56  	Size      int64
    57  	Comment   string
    58  }
    59  
    60  // DELETE "/images/{name:.*}"
    61  type ImageDelete struct {
    62  	Untagged string `json:",omitempty"`
    63  	Deleted  string `json:",omitempty"`
    64  }
    65  
    66  // GET "/images/json"
    67  type Image struct {
    68  	ID          string `json:"Id"`
    69  	ParentId    string
    70  	RepoTags    []string
    71  	RepoDigests []string
    72  	Created     int
    73  	Size        int
    74  	VirtualSize int
    75  	Labels      map[string]string
    76  }
    77  
    78  type GraphDriverData struct {
    79  	Name string
    80  	Data map[string]string
    81  }
    82  
    83  // GET "/images/{name:.*}/json"
    84  type ImageInspect struct {
    85  	Id              string
    86  	Parent          string
    87  	Comment         string
    88  	Created         time.Time
    89  	Container       string
    90  	ContainerConfig *runconfig.Config
    91  	DockerVersion   string
    92  	Author          string
    93  	Config          *runconfig.Config
    94  	Architecture    string
    95  	Os              string
    96  	Size            int64
    97  	VirtualSize     int64
    98  	GraphDriver     GraphDriverData
    99  }
   100  
   101  // GET  "/containers/json"
   102  type Port struct {
   103  	IP          string `json:",omitempty"`
   104  	PrivatePort int
   105  	PublicPort  int `json:",omitempty"`
   106  	Type        string
   107  }
   108  
   109  type Container struct {
   110  	ID         string `json:"Id"`
   111  	Names      []string
   112  	Image      string
   113  	Command    string
   114  	Created    int
   115  	Ports      []Port
   116  	SizeRw     int `json:",omitempty"`
   117  	SizeRootFs int `json:",omitempty"`
   118  	Labels     map[string]string
   119  	Status     string
   120  	HostConfig struct {
   121  		NetworkMode string `json:",omitempty"`
   122  	}
   123  }
   124  
   125  // POST "/containers/"+containerID+"/copy"
   126  type CopyConfig struct {
   127  	Resource string
   128  }
   129  
   130  // GET "/containers/{name:.*}/top"
   131  type ContainerProcessList struct {
   132  	Processes [][]string
   133  	Titles    []string
   134  }
   135  
   136  type Version struct {
   137  	Version       string
   138  	ApiVersion    version.Version
   139  	GitCommit     string
   140  	GoVersion     string
   141  	Os            string
   142  	Arch          string
   143  	KernelVersion string `json:",omitempty"`
   144  	Experimental  bool   `json:",omitempty"`
   145  	BuildTime     string `json:",omitempty"`
   146  }
   147  
   148  // GET "/info"
   149  type Info struct {
   150  	ID                 string
   151  	Containers         int
   152  	Images             int
   153  	Driver             string
   154  	DriverStatus       [][2]string
   155  	MemoryLimit        bool
   156  	SwapLimit          bool
   157  	CpuCfsPeriod       bool
   158  	CpuCfsQuota        bool
   159  	IPv4Forwarding     bool
   160  	BridgeNfIptables   bool
   161  	BridgeNfIp6tables  bool
   162  	Debug              bool
   163  	NFd                int
   164  	OomKillDisable     bool
   165  	NGoroutines        int
   166  	SystemTime         string
   167  	ExecutionDriver    string
   168  	LoggingDriver      string
   169  	NEventsListener    int
   170  	KernelVersion      string
   171  	OperatingSystem    string
   172  	IndexServerAddress string
   173  	RegistryConfig     interface{}
   174  	InitSha1           string
   175  	InitPath           string
   176  	NCPU               int
   177  	MemTotal           int64
   178  	DockerRootDir      string
   179  	HttpProxy          string
   180  	HttpsProxy         string
   181  	NoProxy            string
   182  	Name               string
   183  	Labels             []string
   184  	ExperimentalBuild  bool
   185  }
   186  
   187  // This struct is a temp struct used by execStart
   188  // Config fields is part of ExecConfig in runconfig package
   189  type ExecStartCheck struct {
   190  	// ExecStart will first check if it's detached
   191  	Detach bool
   192  	// Check if there's a tty
   193  	Tty bool
   194  }
   195  
   196  type ContainerState struct {
   197  	Running    bool
   198  	Paused     bool
   199  	Restarting bool
   200  	OOMKilled  bool
   201  	Dead       bool
   202  	Pid        int
   203  	ExitCode   int
   204  	Error      string
   205  	StartedAt  time.Time
   206  	FinishedAt time.Time
   207  }
   208  
   209  // GET "/containers/{name:.*}/json"
   210  type ContainerJSONBase struct {
   211  	Id              string
   212  	Created         time.Time
   213  	Path            string
   214  	Args            []string
   215  	State           *ContainerState
   216  	Image           string
   217  	NetworkSettings *network.Settings
   218  	ResolvConfPath  string
   219  	HostnamePath    string
   220  	HostsPath       string
   221  	LogPath         string
   222  	Name            string
   223  	RestartCount    int
   224  	Driver          string
   225  	ExecDriver      string
   226  	MountLabel      string
   227  	ProcessLabel    string
   228  	Volumes         map[string]string
   229  	VolumesRW       map[string]bool
   230  	AppArmorProfile string
   231  	ExecIDs         []string
   232  	HostConfig      *runconfig.HostConfig
   233  	GraphDriver     GraphDriverData
   234  }
   235  
   236  type ContainerJSON struct {
   237  	*ContainerJSONBase
   238  	Config *runconfig.Config
   239  }
   240  
   241  // backcompatibility struct along with ContainerConfig
   242  type ContainerJSONRaw struct {
   243  	*ContainerJSONBase
   244  	Config *ContainerConfig
   245  }
   246  
   247  type ContainerConfig struct {
   248  	*runconfig.Config
   249  
   250  	// backward compatibility, they now live in HostConfig
   251  	Memory     int64
   252  	MemorySwap int64
   253  	CpuShares  int64
   254  	Cpuset     string
   255  }