mirror of https://github.com/docker/docs.git
				
				
				
			Bump engine-api to fa04f66c7871183dd53a5ec666479f49b452743d
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
		
							parent
							
								
									b6c7becbfe
								
							
						
					
					
						commit
						76d8b0dab7
					
				|  | @ -60,7 +60,7 @@ clone git golang.org/x/net 78cb2c067747f08b343f20614155233ab4ea2ad3 https://gith | |||
| clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git | ||||
| clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3 | ||||
| clone git github.com/docker/go-connections v0.2.0 | ||||
| clone git github.com/docker/engine-api 009ba1641d669613b38818f6f6385b0e74c5728f | ||||
| clone git github.com/docker/engine-api fa04f66c7871183dd53a5ec666479f49b452743d | ||||
| clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837 | ||||
| clone git github.com/imdario/mergo 0.2.1 | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ import ( | |||
| 	"strings" | ||||
| 
 | ||||
| 	"github.com/docker/engine-api/client/transport/cancellable" | ||||
| 	"github.com/docker/engine-api/types" | ||||
| 	"golang.org/x/net/context" | ||||
| ) | ||||
| 
 | ||||
|  | @ -130,7 +131,19 @@ func (cli *Client) sendClientRequest(ctx context.Context, method, path string, q | |||
| 		if len(body) == 0 { | ||||
| 			return serverResp, fmt.Errorf("Error: request returned %s for API route and version %s, check if the server supports the requested API version", http.StatusText(serverResp.statusCode), req.URL) | ||||
| 		} | ||||
| 		return serverResp, fmt.Errorf("Error response from daemon: %s", bytes.TrimSpace(body)) | ||||
| 
 | ||||
| 		var errorMessage string | ||||
| 		if resp.Header.Get("Content-Type") == "application/json" { | ||||
| 			var errorResponse types.ErrorResponse | ||||
| 			if err := json.Unmarshal(body, &errorResponse); err != nil { | ||||
| 				return serverResp, fmt.Errorf("Error reading JSON: %v", err) | ||||
| 			} | ||||
| 			errorMessage = errorResponse.Message | ||||
| 		} else { | ||||
| 			errorMessage = string(body) | ||||
| 		} | ||||
| 
 | ||||
| 		return serverResp, fmt.Errorf("Error response from daemon: %s", strings.TrimSpace(errorMessage)) | ||||
| 	} | ||||
| 
 | ||||
| 	serverResp.body = resp.Body | ||||
|  |  | |||
|  | @ -3,8 +3,29 @@ package container | |||
| import ( | ||||
| 	"github.com/docker/engine-api/types/strslice" | ||||
| 	"github.com/docker/go-connections/nat" | ||||
| 	"time" | ||||
| ) | ||||
| 
 | ||||
| // HealthConfig holds configuration settings for the HEALTHCHECK feature.
 | ||||
| type HealthConfig struct { | ||||
| 	// Test is the test to perform to check that the container is healthy.
 | ||||
| 	// An empty slice means to inherit the default.
 | ||||
| 	// The options are:
 | ||||
| 	// {} : inherit healthcheck
 | ||||
| 	// {"NONE"} : disable healthcheck
 | ||||
| 	// {"CMD", args...} : exec arguments directly
 | ||||
| 	// {"CMD-SHELL", command} : run command with system's default shell
 | ||||
| 	Test []string `json:",omitempty"` | ||||
| 
 | ||||
| 	// Zero means to inherit. Durations are expressed as integer nanoseconds.
 | ||||
| 	Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
 | ||||
| 	Timeout  time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
 | ||||
| 
 | ||||
| 	// Retries is the number of consecutive failures needed to consider a container as unhealthy.
 | ||||
| 	// Zero means inherit.
 | ||||
| 	Retries int `json:",omitempty"` | ||||
| } | ||||
| 
 | ||||
| // Config contains the configuration data about a container.
 | ||||
| // It should hold only portable information about the container.
 | ||||
| // Here, "portable" means "independent from the host we are running on".
 | ||||
|  | @ -24,6 +45,7 @@ type Config struct { | |||
| 	StdinOnce       bool                  // If true, close stdin after the 1 attached client disconnects.
 | ||||
| 	Env             []string              // List of environment variable to set in the container
 | ||||
| 	Cmd             strslice.StrSlice     // Command to run when starting the container
 | ||||
| 	Healthcheck     *HealthConfig         `json:",omitempty"` // Healthcheck describes how to check the container is healthy
 | ||||
| 	ArgsEscaped     bool                  `json:",omitempty"` // True if command is already escaped (Windows specific)
 | ||||
| 	Image           string                // Name of the image as it was passed by the operator (eg. could be symbolic)
 | ||||
| 	Volumes         map[string]struct{}   // List of volumes (mounts) used for the container
 | ||||
|  |  | |||
|  | @ -0,0 +1,6 @@ | |||
| package types | ||||
| 
 | ||||
| // ErrorResponse is the response body of API errors.
 | ||||
| type ErrorResponse struct { | ||||
| 	Message string `json:"message"` | ||||
| } | ||||
|  | @ -276,6 +276,28 @@ type ExecStartCheck struct { | |||
| 	Tty bool | ||||
| } | ||||
| 
 | ||||
| // HealthcheckResult stores information about a single run of a healthcheck probe
 | ||||
| type HealthcheckResult struct { | ||||
| 	Start    time.Time // Start is the time this check started
 | ||||
| 	End      time.Time // End is the time this check ended
 | ||||
| 	ExitCode int       // ExitCode meanings: 0=healthy, 1=unhealthy, 2=starting, else=error running probe
 | ||||
| 	Output   string    // Output from last check
 | ||||
| } | ||||
| 
 | ||||
| // Health states
 | ||||
| const ( | ||||
| 	Starting  = "starting"  // Starting indicates that the container is not yet ready
 | ||||
| 	Healthy   = "healthy"   // Healthy indicates that the container is running correctly
 | ||||
| 	Unhealthy = "unhealthy" // Unhealthy indicates that the container has a problem
 | ||||
| ) | ||||
| 
 | ||||
| // Health stores information about the container's healthcheck results
 | ||||
| type Health struct { | ||||
| 	Status        string               // Status is one of Starting, Healthy or Unhealthy
 | ||||
| 	FailingStreak int                  // FailingStreak is the number of consecutive failures
 | ||||
| 	Log           []*HealthcheckResult // Log contains the last few results (oldest first)
 | ||||
| } | ||||
| 
 | ||||
| // ContainerState stores container's running state
 | ||||
| // it's part of ContainerJSONBase and will return by "inspect" command
 | ||||
| type ContainerState struct { | ||||
|  | @ -290,6 +312,7 @@ type ContainerState struct { | |||
| 	Error      string | ||||
| 	StartedAt  string | ||||
| 	FinishedAt string | ||||
| 	Health     *Health `json:",omitempty"` | ||||
| } | ||||
| 
 | ||||
| // ContainerNode stores information about the node that a container
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue