|
| 1 | +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"). You may |
| 4 | +// not use this file except in compliance with the License. A copy of the |
| 5 | +// License is located at |
| 6 | +// |
| 7 | +// http://aws.amazon.com/apache2.0/ |
| 8 | +// |
| 9 | +// or in the "license" file accompanying this file. This file is distributed |
| 10 | +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 11 | +// express or implied. See the License for the specific language governing |
| 12 | +// permissions and limitations under the License. |
| 13 | +package state |
| 14 | + |
| 15 | +import ( |
| 16 | + "github.com/aws/amazon-ecs-agent/ecs-agent/tmds/handlers/response" |
| 17 | + v2 "github.com/aws/amazon-ecs-agent/ecs-agent/tmds/handlers/v2" |
| 18 | +) |
| 19 | + |
| 20 | +// TaskResponse is the v4 Task response. It augments the v4 Container response |
| 21 | +// with the v2 task response object. |
| 22 | +type TaskResponse struct { |
| 23 | + *v2.TaskResponse |
| 24 | + Containers []ContainerResponse `json:"Containers,omitempty"` |
| 25 | + VPCID string `json:"VPCID,omitempty"` |
| 26 | + ServiceName string `json:"ServiceName,omitempty"` |
| 27 | +} |
| 28 | + |
| 29 | +// ContainerResponse is the v4 Container response. It augments the v4 Network response |
| 30 | +// with the v2 container response object. |
| 31 | +type ContainerResponse struct { |
| 32 | + *v2.ContainerResponse |
| 33 | + Networks []Network `json:"Networks,omitempty"` |
| 34 | +} |
| 35 | + |
| 36 | +// Network is the v4 Network response. It adds a bunch of information about network |
| 37 | +// interface(s) on top of what is supported by v4. |
| 38 | +// See `NetworkInterfaceProperties` for more details. |
| 39 | +type Network struct { |
| 40 | + response.Network |
| 41 | + // NetworkInterfaceProperties specifies additional properties of the network |
| 42 | + // of the network interface that are exposed via the metadata server. |
| 43 | + // We currently populate this only for the `awsvpc` networking mode. |
| 44 | + NetworkInterfaceProperties |
| 45 | +} |
| 46 | + |
| 47 | +// NetworkInterfaceProperties represents additional properties we may want to expose via |
| 48 | +// task metadata about the network interface that's attached to the container/task. We |
| 49 | +// mostly use this to populate data about ENIs for tasks launched with `awsvpc` mode. |
| 50 | +type NetworkInterfaceProperties struct { |
| 51 | + // AttachmentIndex reflects the `index` specified by the customer (if any) |
| 52 | + // while creating the task with `awsvpc` mode. |
| 53 | + AttachmentIndex *int `json:"AttachmentIndex,omitempty"` |
| 54 | + // MACAddress is the MAC address of the network interface. |
| 55 | + MACAddress string `json:"MACAddress,omitempty"` |
| 56 | + // IPv4SubnetCIDRBlock is the IPv4 CIDR address block associated with the interface's subnet. |
| 57 | + IPV4SubnetCIDRBlock string `json:"IPv4SubnetCIDRBlock,omitempty"` |
| 58 | + // IPv6SubnetCIDRBlock is the IPv6 CIDR address block associated with the interface's subnet. |
| 59 | + IPv6SubnetCIDRBlock string `json:"IPv6SubnetCIDRBlock,omitempty"` |
| 60 | + // DomainNameServers specifies the nameserver IP addresses for the network interface. |
| 61 | + DomainNameServers []string `json:"DomainNameServers,omitempty"` |
| 62 | + // DomainNameSearchList specifies the search list for the domain name lookup for |
| 63 | + // the network interface. |
| 64 | + DomainNameSearchList []string `json:"DomainNameSearchList,omitempty"` |
| 65 | + // PrivateDNSName is the dns name assigned to this network interface. |
| 66 | + PrivateDNSName string `json:"PrivateDNSName,omitempty"` |
| 67 | + // SubnetGatewayIPV4Address is the IPv4 gateway address for the network interface. |
| 68 | + SubnetGatewayIPV4Address string `json:"SubnetGatewayIpv4Address,omitempty"` |
| 69 | +} |
0 commit comments