v1

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: Apache-2.0 Imports: 17 Imported by: 10

Documentation

Index

Constants

View Source
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"

	// CredentialsPath specifies the relative URI path for serving task IAM credentials
	CredentialsPath = credentials.V1CredentialsPath
)
View Source
const AgentMetadataPath = "/v1/metadata"

AgentMetadataPath is the Agent metadata path for v1 handler.

View Source
const LicensePath = "/license"
View Source
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 LicenseHandler

func LicenseHandler(w http.ResponseWriter, h *http.Request)

LicenseHandler creates response for '/license' API.

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"`
	Volumes    []VolumeResponse            `json:"Volumes,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.

type VolumeResponse

type VolumeResponse struct {
	DockerName  string `json:"DockerName,omitempty"`
	Source      string `json:"Source,omitempty"`
	Destination string `json:"Destination,omitempty"`
}

VolumeResponse is the schema for the volume response JSON object

func NewVolumesResponse

func NewVolumesResponse(dockerContainer *apicontainer.DockerContainer) []VolumeResponse

NewVolumesResponse creates VolumeResponse for a container

Jump to

Keyboard shortcuts

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