utils

package
v1.20.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2018 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NetworkModeAWSVPC specifies the AWS VPC network mode.
	NetworkModeAWSVPC = "awsvpc"

	// RequestTypeCreds specifies the request type of CredentialsHandler.
	RequestTypeCreds = "credentials"

	// RequestTypeTaskMetadata specifies the task metadata request type of TaskContainerMetadataHandler.
	RequestTypeTaskMetadata = "task metadata"

	// RequestTypeContainerMetadata specifies the container metadata request type of TaskContainerMetadataHandler.
	RequestTypeContainerMetadata = "container metadata"

	// RequestTypeTaskStats specifies the task stats request type of StatsHandler.
	RequestTypeTaskStats = "task stats"

	// RequestTypeContainerStats specifies the container stats request type of StatsHandler.
	RequestTypeContainerStats = "container stats"

	// RequestTypeAgentMetadata specifies the Agent metadata request type of AgentMetadataHandler.
	RequestTypeAgentMetadata = "agent metadata"
)

Variables

This section is empty.

Functions

func ValueFromRequest

func ValueFromRequest(r *http.Request, field string) (string, bool)

ValueFromRequest returns the value of a field in the http request. The boolean value is set to true if the field exists in the query.

func WriteJSONToResponse

func WriteJSONToResponse(w http.ResponseWriter, httpStatusCode int, responseJSON []byte, requestType string)

WriteJSONToResponse writes the header, JSON response to a ResponseWriter, and log the error if necessary.

Types

type DockerStateResolver

type DockerStateResolver interface {
	State() dockerstate.TaskEngineState
}

DockerStateResolver is a sub-interface for the engine.TaskEngine interface to make it easy to test code in this package

type ErrorMessage

type ErrorMessage struct {
	Code          string `json:"code"`
	Message       string `json:"message"`
	HTTPErrorCode int
}

ErrorMessage is used to store the human-readable error Code and a descriptive Message that describes the error. This struct is marshalled and returned in the HTTP response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL