v4

package
v0.0.0-...-ea4ffcd Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 19 Imported by: 3

Documentation

Overview

Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at

http://aws.amazon.com/apache2.0/

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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 + "/"
)

Functions

func ContainerAssociationHandler

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

ContainerAssociationHandler returns the handler method for handling container association requests.

func ContainerAssociationsHandler

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

ContainerAssociationHandler returns the handler method for handling container associations requests.

func GetContainerNetworkMetadata

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

GetContainerNetworkMetadata returns the network metadata for the container

func NewContainerResponse

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

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

func NewPulledContainerResponse

func NewPulledContainerResponse(
	dockerContainer *apicontainer.DockerContainer,
	eni *ni.NetworkInterface,
) tmdsv4.ContainerResponse

NewPulledContainerResponse creates a new v4 container response for a pulled container. It augments v4 container response with an additional empty network interface field.

func NewTaskResponse

func NewTaskResponse(
	taskARN string,
	state dockerstate.TaskEngineState,
	ecsClient ecs.ECSClient,
	cluster string,
	az string,
	vpcID string,
	containerInstanceARN string,
	serviceName string,
	propagateTags bool,
) (*tmdsv4.TaskResponse, error)

NewTaskResponse creates a new v4 response object for the task. It augments v2 task response with additional fields for the v4 response.

func NewV4TaskStatsResponse

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

NewV4TaskStatsResponse returns a new v4 task stats response object

Types

type TMDSAgentState

type TMDSAgentState struct {
	// contains filtered or unexported fields
}

Implements AgentState interface for TMDS v4.

func NewTMDSAgentState

func NewTMDSAgentState(
	state dockerstate.TaskEngineState,
	statsEngine stats.Engine,
	ecsClient ecs.ECSClient,
	cluster string,
	availabilityZone string,
	vpcID string,
	containerInstanceARN string,
) *TMDSAgentState

func (*TMDSAgentState) GetContainerMetadata

func (s *TMDSAgentState) GetContainerMetadata(v3EndpointID string) (tmdsv4.ContainerResponse, error)

Returns container metadata in v4 format for the container identified by the provided v3EndpointID.

func (*TMDSAgentState) GetContainerStats

func (s *TMDSAgentState) GetContainerStats(v3EndpointID string) (tmdsv4.StatsResponse, error)

func (*TMDSAgentState) GetTaskMetadata

func (s *TMDSAgentState) GetTaskMetadata(v3EndpointID string) (tmdsv4.TaskResponse, error)

Returns task metadata in v4 format for the task identified by the provided endpointContainerID.

func (*TMDSAgentState) GetTaskMetadataWithTags

func (s *TMDSAgentState) GetTaskMetadataWithTags(v3EndpointID string) (tmdsv4.TaskResponse, error)

Returns task metadata including task and container instance tags in v4 format for the task identified by the provided endpointContainerID.

func (*TMDSAgentState) GetTaskMetadataWithTaskNetworkConfig

func (s *TMDSAgentState) GetTaskMetadataWithTaskNetworkConfig(v3EndpointID string, networkConfigClient *netconfig.NetworkConfigClient) (tmdsv4.TaskResponse, error)

Returns task metadata including the task network configuration in v4 format for the task identified by the provided endpointContainerID.

func (*TMDSAgentState) GetTaskStats

func (s *TMDSAgentState) GetTaskStats(v3EndpointID string) (map[string]*tmdsv4.StatsResponse, error)

Jump to

Keyboard shortcuts

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