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