Documentation ¶
Index ¶
- Constants
- func AgentMetadataHandler(containerInstanceArn *string, cfg *config.Config) func(http.ResponseWriter, *http.Request)
- func CredentialsHandler(credentialsManager credentials.Manager, auditLogger audit.AuditLogger) func(http.ResponseWriter, *http.Request)
- func CredentialsHandlerImpl(w http.ResponseWriter, r *http.Request, auditLogger audit.AuditLogger, ...)
- func TaskContainerMetadataHandler(taskEngine utils.DockerStateResolver) func(http.ResponseWriter, *http.Request)
- type ContainerResponse
- type MetadataResponse
- type PortResponse
- type TaskResponse
- type TasksResponse
Constants ¶
const ( // ErrNoIDInRequest is the error code indicating that no ID was specified ErrNoIDInRequest = "NoIdInRequest" // ErrInvalidIDInRequest is the error code indicating that the ID was invalid ErrInvalidIDInRequest = "InvalidIdInRequest" // ErrNoCredentialsAssociated is the error code indicating no credentials are // associated with the specified ID ErrNoCredentialsAssociated = "NoCredentialsAssociated" // ErrCredentialsUninitialized is the error code indicating that credentials were // not properly initialized. This may happen immediately after the agent is // started, before it has completed state reconciliation. ErrCredentialsUninitialized = "CredentialsUninitialized" // ErrInternalServer is the error indicating something generic went wrong ErrInternalServer = "InternalServerError" )
const AgentMetadataPath = "/v1/metadata"
AgentMetadataPath is the Agent metadata path for v1 handler.
const (
// TaskContainerMetadataPath is the task/container metadata path for v1 handler.
TaskContainerMetadataPath = "/v1/tasks"
)
Variables ¶
This section is empty.
Functions ¶
func AgentMetadataHandler ¶
func AgentMetadataHandler(containerInstanceArn *string, cfg *config.Config) func(http.ResponseWriter, *http.Request)
AgentMetadataHandler creates response for 'v1/metadata' API.
func CredentialsHandler ¶
func CredentialsHandler(credentialsManager credentials.Manager, auditLogger audit.AuditLogger) func(http.ResponseWriter, *http.Request)
CredentialsHandler creates response for the 'v1/credentials' API. It returns a JSON response containing credentials when found. The HTTP status code of 400 is returned otherwise.
func CredentialsHandlerImpl ¶
func CredentialsHandlerImpl(w http.ResponseWriter, r *http.Request, auditLogger audit.AuditLogger, credentialsManager credentials.Manager, credentialsID string, errPrefix string)
CredentialsHandlerImpl is the major logic in CredentialsHandler, abstract this out because v2.CredentialsHandler also uses the same logic.
func TaskContainerMetadataHandler ¶
func TaskContainerMetadataHandler(taskEngine utils.DockerStateResolver) func(http.ResponseWriter, *http.Request)
TaskContainerMetadataHandler creates response for the 'v1/tasks' API. Lists all tasks if the request doesn't contain any fields. Returns a Task if either of 'dockerid' or 'taskarn' are specified in the request.
Types ¶
type ContainerResponse ¶
type ContainerResponse struct { DockerID string `json:"DockerId"` DockerName string `json:"DockerName"` Name string `json:"Name"` Ports []PortResponse `json:"Ports,omitempty"` Networks []containermetadata.Network `json:"Networks,omitempty"` }
ContainerResponse is the schema for the container response JSON object
func NewContainerResponse ¶
func NewContainerResponse(dockerContainer *apicontainer.DockerContainer, eni *apieni.ENI) ContainerResponse
NewContainerResponse creates ContainerResponse for a container.
type MetadataResponse ¶
type MetadataResponse struct { Cluster string `json:"Cluster"` ContainerInstanceArn *string `json:"ContainerInstanceArn"` Version string `json:"Version"` }
MetadataResponse is the schema for the metadata response JSON object
type PortResponse ¶
type PortResponse struct { ContainerPort uint16 `json:"ContainerPort,omitempty"` Protocol string `json:"Protocol,omitempty"` HostPort uint16 `json:"HostPort,omitempty"` }
PortResponse defines the schema for portmapping response JSON object.
func NewPortBindingsResponse ¶
func NewPortBindingsResponse(dockerContainer *apicontainer.DockerContainer, eni *apieni.ENI) []PortResponse
NewPortBindingsResponse creates PortResponse for a container.
type TaskResponse ¶
type TaskResponse struct { Arn string `json:"Arn"` DesiredStatus string `json:"DesiredStatus,omitempty"` KnownStatus string `json:"KnownStatus"` Family string `json:"Family"` Version string `json:"Version"` Containers []ContainerResponse `json:"Containers"` }
TaskResponse is the schema for the task response JSON object
func NewTaskResponse ¶
func NewTaskResponse(task *apitask.Task, containerMap map[string]*apicontainer.DockerContainer) *TaskResponse
NewTaskResponse creates a TaskResponse for a task.
type TasksResponse ¶
type TasksResponse struct {
Tasks []*TaskResponse `json:"Tasks"`
}
TasksResponse is the schema for the tasks response JSON object
func NewTasksResponse ¶
func NewTasksResponse(state dockerstate.TaskEngineState) *TasksResponse
NewTasksResponse creates TasksResponse for all the tasks.