Documentation ¶
Index ¶
- Constants
- Variables
- func CredentialsHandler(credentialsManager credentials.Manager, auditLogger audit.AuditLogger) func(http.ResponseWriter, *http.Request)
- func NewTaskStatsResponse(taskARN string, state dockerstate.TaskEngineState, statsEngine stats.Engine) (map[string]*types.StatsJSON, error)
- func TaskContainerMetadataHandler(state dockerstate.TaskEngineState, ecsClient api.ECSClient, ...) func(http.ResponseWriter, *http.Request)
- func TaskContainerStatsHandler(state dockerstate.TaskEngineState, statsEngine stats.Engine) func(http.ResponseWriter, *http.Request)
- func WriteContainerMetadataResponse(w http.ResponseWriter, containerID string, state dockerstate.TaskEngineState)
- func WriteContainerStatsResponse(w http.ResponseWriter, taskARN string, containerID string, ...)
- func WriteTaskMetadataResponse(w http.ResponseWriter, taskARN string, cluster string, ...)
- func WriteTaskStatsResponse(w http.ResponseWriter, taskARN string, state dockerstate.TaskEngineState, ...)
- type ContainerResponse
- type LimitsResponse
- type TaskResponse
Constants ¶
const ( // TaskMetadataPath specifies the relative URI path for serving task metadata. TaskMetadataPath = "/v2/metadata" // TaskWithTagsMetadataPath specifies the relative URI path for serving task metadata with Container Instance and Task Tags. TaskWithTagsMetadataPath = "/v2/metadataWithTags" // TaskMetadataPathWithSlash specifies the relative URI path for serving task metadata. TaskMetadataPathWithSlash = TaskMetadataPath + "/" // TaskWithTagsMetadataPath specifies the relative URI path for serving task metadata with Container Instance and Task Tags. TaskWithTagsMetadataPathWithSlash = TaskWithTagsMetadataPath + "/" )
const ( // TaskStatsPath specifies the relative URI path for serving task stats. TaskStatsPath = "/v2/stats" // TaskStatsPathWithSlash specifies the relative URI path for serving task stats. TaskStatsPathWithSlash = TaskStatsPath + "/" )
Variables ¶
var ContainerMetadataPath = TaskMetadataPathWithSlash + utils.ConstructMuxVar(metadataContainerIDMuxName, utils.AnythingButEmptyRegEx)
ContainerMetadataPath specifies the relative URI path for serving container metadata.
var ContainerStatsPath = TaskStatsPathWithSlash + utils.ConstructMuxVar(statsContainerIDMuxName, utils.AnythingButEmptyRegEx)
ContainerStatsPath specifies the relative URI path for serving container stats.
var CredentialsPath = credentials.V2CredentialsPath + "/" + utils.ConstructMuxVar(credentialsIDMuxName, utils.AnythingRegEx)
CredentialsPath specifies the relative URI path for serving task IAM credentials. Use "AnythingRegEx" regex to handle the case where the "credentialsIDMuxName" is empty, this is because the name that's used to extract dynamic value in gorilla cannot be empty by default. If we don't do this, we will get 404 error when we access "/v2/credentials/", but it should be 400 error.
Functions ¶
func CredentialsHandler ¶
func CredentialsHandler(credentialsManager credentials.Manager, auditLogger audit.AuditLogger) func(http.ResponseWriter, *http.Request)
CredentialsHandler creates response for the 'v2/credentials' API.
func NewTaskStatsResponse ¶
func NewTaskStatsResponse(taskARN string, state dockerstate.TaskEngineState, statsEngine stats.Engine) (map[string]*types.StatsJSON, error)
NewTaskStatsResponse returns a new task stats response object
func TaskContainerMetadataHandler ¶
func TaskContainerMetadataHandler(state dockerstate.TaskEngineState, ecsClient api.ECSClient, cluster, az, containerInstanceArn string, propagateTags bool) func(http.ResponseWriter, *http.Request)
TaskContainerMetadataHandler returns the handler method for handling task and container metadata requests.
func TaskContainerStatsHandler ¶
func TaskContainerStatsHandler(state dockerstate.TaskEngineState, statsEngine stats.Engine) func(http.ResponseWriter, *http.Request)
TaskContainerStatsHandler returns the handler method for handling task and container stats requests.
func WriteContainerMetadataResponse ¶
func WriteContainerMetadataResponse(w http.ResponseWriter, containerID string, state dockerstate.TaskEngineState)
WriteContainerMetadataResponse writes the container metadata to response writer.
func WriteContainerStatsResponse ¶
func WriteContainerStatsResponse(w http.ResponseWriter, taskARN string, containerID string, statsEngine stats.Engine)
WriteContainerStatsResponse writes the container stats to response writer.
func WriteTaskMetadataResponse ¶
func WriteTaskMetadataResponse(w http.ResponseWriter, taskARN string, cluster string, state dockerstate.TaskEngineState, ecsClient api.ECSClient, az, containerInstanceArn string, propagateTags bool)
WriteTaskMetadataResponse writes the task metadata to response writer.
func WriteTaskStatsResponse ¶
func WriteTaskStatsResponse(w http.ResponseWriter, taskARN string, state dockerstate.TaskEngineState, statsEngine stats.Engine)
WriteTaskStatsResponse writes the task stats to response writer.
Types ¶
type ContainerResponse ¶
type ContainerResponse struct { ID string `json:"DockerId"` Name string `json:"Name"` DockerName string `json:"DockerName"` Image string `json:"Image"` ImageID string `json:"ImageID"` Ports []v1.PortResponse `json:"Ports,omitempty"` Labels map[string]string `json:"Labels,omitempty"` DesiredStatus string `json:"DesiredStatus"` KnownStatus string `json:"KnownStatus"` ExitCode *int `json:"ExitCode,omitempty"` Limits LimitsResponse `json:"Limits"` CreatedAt *time.Time `json:"CreatedAt,omitempty"` StartedAt *time.Time `json:"StartedAt,omitempty"` FinishedAt *time.Time `json:"FinishedAt,omitempty"` Type string `json:"Type"` Networks []containermetadata.Network `json:"Networks,omitempty"` Health *apicontainer.HealthStatus `json:"Health,omitempty"` Volumes []v1.VolumeResponse `json:"Volumes,omitempty"` }
ContainerResponse defines the schema for the container response JSON object
func NewContainerResponse ¶
func NewContainerResponse(containerID string, state dockerstate.TaskEngineState) (*ContainerResponse, error)
NewContainerResponse creates a new container response based on container id
type LimitsResponse ¶
type LimitsResponse struct { CPU *float64 `json:"CPU,omitempty"` Memory *int64 `json:"Memory,omitempty"` }
LimitsResponse defines the schema for task/cpu limits response JSON object
type TaskResponse ¶
type TaskResponse struct { Cluster string `json:"Cluster"` TaskARN string `json:"TaskARN"` Family string `json:"Family"` Revision string `json:"Revision"` DesiredStatus string `json:"DesiredStatus,omitempty"` KnownStatus string `json:"KnownStatus"` Containers []ContainerResponse `json:"Containers,omitempty"` Limits *LimitsResponse `json:"Limits,omitempty"` PullStartedAt *time.Time `json:"PullStartedAt,omitempty"` PullStoppedAt *time.Time `json:"PullStoppedAt,omitempty"` ExecutionStoppedAt *time.Time `json:"ExecutionStoppedAt,omitempty"` AvailabilityZone string `json:"AvailabilityZone,omitempty"` TaskTags map[string]string `json:"TaskTags,omitempty"` ContainerInstanceTags map[string]string `json:"ContainerInstanceTags,omitempty"` }
TaskResponse defines the schema for the task response JSON object
func NewTaskResponse ¶
func NewTaskResponse(taskARN string, state dockerstate.TaskEngineState, ecsClient api.ECSClient, cluster string, az string, containerInstanceArn string, propagateTags bool) (*TaskResponse, error)
NewTaskResponse creates a new response object for the task