v4

package
v1.44.3 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Container associations endpoint: /v4/<v3 endpoint id>/<association type>
	ContainerAssociationsPath = fmt.Sprintf("/v4/%s/associations/%s",
		utils.ConstructMuxVar(v3.V3EndpointIDMuxName, utils.AnythingButSlashRegEx),
		utils.ConstructMuxVar(associationTypeMuxName, utils.AnythingButSlashRegEx))
	// Container association endpoint: /v4/<v3 endpoint id>/<association type>/<association name>
	ContainerAssociationPath = fmt.Sprintf("/v4/%s/associations/%s/%s",
		utils.ConstructMuxVar(v3.V3EndpointIDMuxName, utils.AnythingButSlashRegEx),
		utils.ConstructMuxVar(associationTypeMuxName, utils.AnythingButSlashRegEx),
		utils.ConstructMuxVar(associationNameMuxName, utils.AnythingButEmptyRegEx))
	// Treat "/v4/<v3 endpoint id>/<association type>/" as a container association endpoint with empty association name (therefore invalid), to be consistent with similar situation in credentials endpoint and v3 metadata endpoint
	ContainerAssociationPathWithSlash = ContainerAssociationsPath + "/"
)

ContainerMetadataPath specifies the relative URI path for serving container metadata.

View Source
var ContainerStatsPath = "/v4/" + utils.ConstructMuxVar(v3.V3EndpointIDMuxName, utils.AnythingButSlashRegEx) + "/stats"

ContainerStatsPath specifies the relative URI path for serving container stats.

View Source
var TaskMetadataPath = "/v4/" + utils.ConstructMuxVar(v3.V3EndpointIDMuxName, utils.AnythingButSlashRegEx) + "/task"

TaskMetadataPath specifies the relative URI path for serving task metadata.

View Source
var TaskStatsPath = "/v4/" + utils.ConstructMuxVar(v3.V3EndpointIDMuxName, utils.AnythingButSlashRegEx) + "/task/stats"
View Source
var TaskWithTagsMetadataPath = "/v4/" + utils.ConstructMuxVar(v3.V3EndpointIDMuxName, utils.AnythingButSlashRegEx) + "/taskWithTags"

TaskWithTagsMetadataPath specifies the relative URI path for serving task metdata with Container Instance and Task Tags retrieved through the ECS API

Functions

func ContainerAssociationHandler added in v1.39.0

func ContainerAssociationHandler(state dockerstate.TaskEngineState) func(http.ResponseWriter, *http.Request)

ContainerAssociationHandler returns the handler method for handling container association requests.

func ContainerAssociationsHandler added in v1.39.0

func ContainerAssociationsHandler(state dockerstate.TaskEngineState) func(http.ResponseWriter, *http.Request)

ContainerAssociationHandler returns the handler method for handling container associations requests.

func ContainerMetadataHandler added in v1.39.0

func ContainerMetadataHandler(state dockerstate.TaskEngineState) func(http.ResponseWriter, *http.Request)

ContainerMetadataHandler returns the handler method for handling container metadata requests.

func ContainerStatsHandler added in v1.39.0

func ContainerStatsHandler(state dockerstate.TaskEngineState, statsEngine stats.Engine) func(w http.ResponseWriter, r *http.Request)

ContainerStatsHandler returns the handler method for handling container stats requests.

func NewV4TaskStatsResponse added in v1.43.0

func NewV4TaskStatsResponse(taskARN string,
	state dockerstate.TaskEngineState,
	statsEngine stats.Engine) (map[string]StatsResponse, error)

NewV4TaskStatsResponse returns a new v4 task stats response object

func TaskMetadataHandler added in v1.39.0

func TaskMetadataHandler(state dockerstate.TaskEngineState, ecsClient api.ECSClient, cluster, az, containerInstanceArn string, propagateTags bool) func(http.ResponseWriter, *http.Request)

TaskMetadataHandler returns the handler method for handling task metadata requests.

func TaskStatsHandler added in v1.39.0

func TaskStatsHandler(state dockerstate.TaskEngineState, statsEngine stats.Engine) func(http.ResponseWriter, *http.Request)

func WriteV4ContainerStatsResponse added in v1.43.0

func WriteV4ContainerStatsResponse(w http.ResponseWriter,
	taskARN string,
	containerID string,
	statsEngine stats.Engine)

WriteContainerStatsResponse writes the container stats to response writer.

func WriteV4TaskStatsResponse added in v1.43.0

func WriteV4TaskStatsResponse(w http.ResponseWriter,
	taskARN string,
	state dockerstate.TaskEngineState,
	statsEngine stats.Engine)

WriteV4TaskStatsResponse writes the task stats to response writer.

Types

type ContainerResponse

type ContainerResponse struct {
	*v2.ContainerResponse
	Networks []Network `json:"Networks,omitempty"`
}

ContainerResponse is the v4 Container response. It augments the v4 Network response with the v2 container response object.

func GetContainerResponse added in v1.39.0

func GetContainerResponse(containerID string, state dockerstate.TaskEngineState) (*ContainerResponse, error)

GetContainerResponse gets container response for v4 metadata

func NewContainerResponse

func NewContainerResponse(
	containerID string,
	state dockerstate.TaskEngineState,
) (*ContainerResponse, error)

NewContainerResponse creates a new v4 container response based on container id. It augments v4 container response with additional network interface fields.

type Network

type Network struct {
	containermetadata.Network
	// NetworkInterfaceProperties specifies additional properties of the network
	// of the network interface that are exposed via the metadata server.
	// We currently populate this only for the `awsvpc` networking mode.
	NetworkInterfaceProperties
}

Network is the v4 Network response. It adds a bunch of information about network interface(s) on top of what is supported by v4. See `NetworkInterfaceProperties` for more details.

func GetContainerNetworkMetadata added in v1.39.0

func GetContainerNetworkMetadata(containerID string, state dockerstate.TaskEngineState) ([]Network, error)

GetContainerNetworkMetadata returns the network metadata for the container

type NetworkInterfaceProperties

type NetworkInterfaceProperties struct {
	// AttachmentIndex reflects the `index` specified by the customer (if any)
	// while creating the task with `awsvpc` mode.
	AttachmentIndex *int `json:"AttachmentIndex,omitempty"`
	// IPV4SubnetCIDRBlock is the subnet CIDR netmask associated with network interface.
	IPV4SubnetCIDRBlock string `json:"IPv4SubnetCIDRBlock,omitempty"`
	// MACAddress is the mac address of the network interface.
	MACAddress string `json:"MACAddress,omitempty"`
	// DomainNameServers specifies the nameserver IP addresses for the network interface.
	DomainNameServers []string `json:"DomainNameServers,omitempty"`
	// DomainNameSearchList specifies the search list for the domain name lookup for
	// the network interface.
	DomainNameSearchList []string `json:"DomainNameSearchList,omitempty"`
	// PrivateDNSName is the dns name assigned to this network interface.
	PrivateDNSName string `json:"PrivateDNSName,omitempty"`
	// SubnetGatewayIPV4Address is the gateway address for the network interface.
	SubnetGatewayIPV4Address string `json:"SubnetGatewayIpv4Address,omitempty"`
}

NetworkInterfaceProperties represents additional properties we may want to expose via task metadata about the network interface that's attached to the container/task. We mostly use this to populate data about ENIs for tasks launched with `awsvpc` mode.

type StatsResponse added in v1.43.0

type StatsResponse struct {
	*types.StatsJSON
	Network_rate_stats *stats.NetworkStatsPerSec `json:"network_rate_stats,omitempty"`
}

StatsResponse is the v4 Stats response. It augments the v4 Stats response with the docker stats.

type TaskResponse

type TaskResponse struct {
	*v2.TaskResponse
	Containers []ContainerResponse `json:"Containers,omitempty"`
}

TaskResponse is the v4 Task response. It augments the v4 Container response with the v2 task response 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 v4 response object for the task. It augments v2 task response with additional network interface fields.

Jump to

Keyboard shortcuts

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