From 78ff03a0cae9c30dd68da04a8fe7f714584aedb0 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Thu, 22 Sep 2022 14:12:32 -0700 Subject: [PATCH 1/5] Bump Go version to 1.19.1 pickup the fix for https://nvd.nist.gov/vuln/detail/CVE-2022-27664 --- GO_VERSION | 2 +- GO_VERSION_WINDOWS | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GO_VERSION b/GO_VERSION index b9fb27ab4f7..66e2ae6c25c 100644 --- a/GO_VERSION +++ b/GO_VERSION @@ -1 +1 @@ -1.18.3 +1.19.1 diff --git a/GO_VERSION_WINDOWS b/GO_VERSION_WINDOWS index b9fb27ab4f7..66e2ae6c25c 100644 --- a/GO_VERSION_WINDOWS +++ b/GO_VERSION_WINDOWS @@ -1 +1 @@ -1.18.3 +1.19.1 From d419ec5325d63e9c5d0f199fbd752ae2ee81b436 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Thu, 22 Sep 2022 14:27:53 -0700 Subject: [PATCH 2/5] make goimports --- agent/api/container/container_test.go | 2 +- agent/api/task/task_linux.go | 11 +- agent/app/agent_capability.go | 94 +- agent/app/data.go | 24 +- agent/config/conditional.go | 2 +- agent/config/doc.go | 2 +- .../instancecreds/instancecreds_linux.go | 8 +- .../instancecreds_unsupported.go | 8 +- .../instancecreds/instancecreds_windows.go | 30 +- agent/dockerclient/dockerapi/docker_client.go | 29 +- agent/dockerclient/dockerauth/doc.go | 7 +- agent/ecr/model/ecr/api.go | 17 +- agent/ecr/model/ecr/service.go | 11 +- agent/ecs_client/model/ecs/api.go | 1585 ++++++++--------- agent/ecs_client/model/ecs/service.go | 11 +- agent/ecscni/types_linux.go | 2 +- agent/engine/common_integ_test.go | 15 +- agent/engine/docker_image_manager.go | 2 +- .../engine/docker_image_manager_integ_test.go | 26 +- agent/engine/docker_task_engine.go | 2 +- agent/engine/docker_task_engine_test.go | 13 +- agent/engine/task_manager.go | 9 +- agent/engine/task_manager_unix_test.go | 2 +- agent/metrics/generic_metrics_client.go | 9 +- agent/metrics/metrics_test.go | 2 +- agent/sighandlers/termination_handler.go | 7 +- agent/ssm/factory/factory.go | 2 +- agent/taskresource/firelens/firelens_unix.go | 11 +- .../firelens/firelensconfig_unix.go | 10 +- agent/version/formatting.go | 6 +- agent/wsclient/client.go | 4 +- 31 files changed, 969 insertions(+), 994 deletions(-) diff --git a/agent/api/container/container_test.go b/agent/api/container/container_test.go index 5aa8f2a701c..041532883ec 100644 --- a/agent/api/container/container_test.go +++ b/agent/api/container/container_test.go @@ -138,7 +138,7 @@ func TestIsInternal(t *testing.T) { } // TestSetupExecutionRoleFlag tests whether or not the container appropriately -//sets the flag for using execution roles +// sets the flag for using execution roles func TestSetupExecutionRoleFlag(t *testing.T) { testCases := []struct { container *Container diff --git a/agent/api/task/task_linux.go b/agent/api/task/task_linux.go index f5ffb170516..f43c778252e 100644 --- a/agent/api/task/task_linux.go +++ b/agent/api/task/task_linux.go @@ -98,11 +98,12 @@ func buildCgroupV1Root(taskID string) string { // buildCgroupV2Root creates a root cgroup using the systemd driver's special "-" // character. The "-" specifies a parent slice, so tasks and their containers end up // looking like this in the cgroup directory: -// /sys/fs/cgroup/ecstasks.slice/ -// ├── ecstasks-XXXXf406f70c4c678073ae96944fXXXX.slice -// │ └── docker-XXXX7c6dc81f2e9a8bf1c566dc769733ccba594b3007dd289a0f50ad7923XXXX.scope -// └── ecstasks-XXXX30467358463ab6bbba4e73afXXXX.slice -// └── docker-XXXX7ef4e942552437c96051356859c1df169f16e1cf9a9fc96fd30614e6XXXX.scope +// +// /sys/fs/cgroup/ecstasks.slice/ +// ├── ecstasks-XXXXf406f70c4c678073ae96944fXXXX.slice +// │ └── docker-XXXX7c6dc81f2e9a8bf1c566dc769733ccba594b3007dd289a0f50ad7923XXXX.scope +// └── ecstasks-XXXX30467358463ab6bbba4e73afXXXX.slice +// └── docker-XXXX7ef4e942552437c96051356859c1df169f16e1cf9a9fc96fd30614e6XXXX.scope func buildCgroupV2Root(taskID string) string { return fmt.Sprintf("%s-%s.slice", config.DefaultTaskCgroupV2Prefix, taskID) } diff --git a/agent/app/agent_capability.go b/agent/app/agent_capability.go index 5febc49fc2a..86b2bbe4378 100644 --- a/agent/app/agent_capability.go +++ b/agent/app/agent_capability.go @@ -129,53 +129,53 @@ var ( // capabilities returns the supported capabilities of this agent / docker-client pair. // Currently, the following capabilities are possible: // -// com.amazonaws.ecs.capability.privileged-container -// com.amazonaws.ecs.capability.docker-remote-api.1.17 -// com.amazonaws.ecs.capability.docker-remote-api.1.18 -// com.amazonaws.ecs.capability.docker-remote-api.1.19 -// com.amazonaws.ecs.capability.docker-remote-api.1.20 -// com.amazonaws.ecs.capability.logging-driver.json-file -// com.amazonaws.ecs.capability.logging-driver.syslog -// com.amazonaws.ecs.capability.logging-driver.fluentd -// com.amazonaws.ecs.capability.logging-driver.journald -// com.amazonaws.ecs.capability.logging-driver.gelf -// com.amazonaws.ecs.capability.logging-driver.none -// com.amazonaws.ecs.capability.selinux -// com.amazonaws.ecs.capability.apparmor -// com.amazonaws.ecs.capability.ecr-auth -// com.amazonaws.ecs.capability.task-iam-role -// com.amazonaws.ecs.capability.task-iam-role-network-host -// ecs.capability.docker-volume-driver.${driverName} -// ecs.capability.task-eni -// ecs.capability.task-eni-block-instance-metadata -// ecs.capability.execution-role-ecr-pull -// ecs.capability.execution-role-awslogs -// ecs.capability.container-health-check -// ecs.capability.private-registry-authentication.secretsmanager -// ecs.capability.secrets.ssm.environment-variables -// ecs.capability.secrets.ssm.bootstrap.log-driver -// ecs.capability.pid-ipc-namespace-sharing -// ecs.capability.ecr-endpoint -// ecs.capability.secrets.asm.environment-variables -// ecs.capability.secrets.asm.bootstrap.log-driver -// ecs.capability.aws-appmesh -// ecs.capability.task-eia -// ecs.capability.task-eni-trunking -// ecs.capability.task-eia.optimized-cpu -// ecs.capability.firelens.fluentd -// ecs.capability.firelens.fluentbit -// ecs.capability.efs -// com.amazonaws.ecs.capability.logging-driver.awsfirelens -// ecs.capability.logging-driver.awsfirelens.log-driver-buffer-limit -// ecs.capability.firelens.options.config.file -// ecs.capability.firelens.options.config.s3 -// ecs.capability.full-sync -// ecs.capability.gmsa -// ecs.capability.efsAuth -// ecs.capability.env-files.s3 -// ecs.capability.fsxWindowsFileServer -// ecs.capability.execute-command -// ecs.capability.external +// com.amazonaws.ecs.capability.privileged-container +// com.amazonaws.ecs.capability.docker-remote-api.1.17 +// com.amazonaws.ecs.capability.docker-remote-api.1.18 +// com.amazonaws.ecs.capability.docker-remote-api.1.19 +// com.amazonaws.ecs.capability.docker-remote-api.1.20 +// com.amazonaws.ecs.capability.logging-driver.json-file +// com.amazonaws.ecs.capability.logging-driver.syslog +// com.amazonaws.ecs.capability.logging-driver.fluentd +// com.amazonaws.ecs.capability.logging-driver.journald +// com.amazonaws.ecs.capability.logging-driver.gelf +// com.amazonaws.ecs.capability.logging-driver.none +// com.amazonaws.ecs.capability.selinux +// com.amazonaws.ecs.capability.apparmor +// com.amazonaws.ecs.capability.ecr-auth +// com.amazonaws.ecs.capability.task-iam-role +// com.amazonaws.ecs.capability.task-iam-role-network-host +// ecs.capability.docker-volume-driver.${driverName} +// ecs.capability.task-eni +// ecs.capability.task-eni-block-instance-metadata +// ecs.capability.execution-role-ecr-pull +// ecs.capability.execution-role-awslogs +// ecs.capability.container-health-check +// ecs.capability.private-registry-authentication.secretsmanager +// ecs.capability.secrets.ssm.environment-variables +// ecs.capability.secrets.ssm.bootstrap.log-driver +// ecs.capability.pid-ipc-namespace-sharing +// ecs.capability.ecr-endpoint +// ecs.capability.secrets.asm.environment-variables +// ecs.capability.secrets.asm.bootstrap.log-driver +// ecs.capability.aws-appmesh +// ecs.capability.task-eia +// ecs.capability.task-eni-trunking +// ecs.capability.task-eia.optimized-cpu +// ecs.capability.firelens.fluentd +// ecs.capability.firelens.fluentbit +// ecs.capability.efs +// com.amazonaws.ecs.capability.logging-driver.awsfirelens +// ecs.capability.logging-driver.awsfirelens.log-driver-buffer-limit +// ecs.capability.firelens.options.config.file +// ecs.capability.firelens.options.config.s3 +// ecs.capability.full-sync +// ecs.capability.gmsa +// ecs.capability.efsAuth +// ecs.capability.env-files.s3 +// ecs.capability.fsxWindowsFileServer +// ecs.capability.execute-command +// ecs.capability.external func (agent *ecsAgent) capabilities() ([]*ecs.Attribute, error) { var capabilities []*ecs.Attribute diff --git a/agent/app/data.go b/agent/app/data.go index ea5930478c8..0c1e41deaca 100644 --- a/agent/app/data.go +++ b/agent/app/data.go @@ -46,20 +46,20 @@ type savedData struct { // load from boltdb, and if it doesn't get anything, it tries to load from state file and then save data it loaded to // boltdb. Behavior of three cases are considered: // -// 1. Agent starts from fresh instance (no previous state): -// (1) Try to load from boltdb, get nothing; -// (2) Try to load from state file, get nothing; -// (3) Return empty data. +// 1. Agent starts from fresh instance (no previous state): +// (1) Try to load from boltdb, get nothing; +// (2) Try to load from state file, get nothing; +// (3) Return empty data. // -// 2. Agent starts with previous state stored in boltdb: -// (1) Try to load from boltdb, get the data; -// (2) Return loaded data. +// 2. Agent starts with previous state stored in boltdb: +// (1) Try to load from boltdb, get the data; +// (2) Return loaded data. // -// 3. Agent starts with previous state stored in state file (i.e. it was just upgraded from an old agent that uses state file): -// (1) Try to load from boltdb, get nothing; -// (2) Try to load from state file, get something; -// (3) Save loaded data to boltdb; -// (4) Return loaded data. +// 3. Agent starts with previous state stored in state file (i.e. it was just upgraded from an old agent that uses state file): +// (1) Try to load from boltdb, get nothing; +// (2) Try to load from state file, get something; +// (3) Save loaded data to boltdb; +// (4) Return loaded data. func (agent *ecsAgent) loadData(containerChangeEventStream *eventstream.EventStream, credentialsManager credentials.Manager, state dockerstate.TaskEngineState, diff --git a/agent/config/conditional.go b/agent/config/conditional.go index b6f8be049b8..f6cd5568ff6 100644 --- a/agent/config/conditional.go +++ b/agent/config/conditional.go @@ -71,7 +71,7 @@ type BooleanDefaultFalse struct { Value Conditional } -/// Enabled is a convenience function for when consumers don't care if the value is implicit or explicit +// / Enabled is a convenience function for when consumers don't care if the value is implicit or explicit func (b BooleanDefaultFalse) Enabled() bool { return b.Value == ExplicitlyEnabled } diff --git a/agent/config/doc.go b/agent/config/doc.go index d67369a5d5c..e41fe25125b 100644 --- a/agent/config/doc.go +++ b/agent/config/doc.go @@ -15,7 +15,7 @@ Package config handles loading configuration data, warning on missing data, and setting sane defaults. -Configuration Sources +# Configuration Sources Configuration data is loaded from two sources currently: the environment and a json config file. diff --git a/agent/credentials/instancecreds/instancecreds_linux.go b/agent/credentials/instancecreds/instancecreds_linux.go index a78008874e1..b94452635ad 100644 --- a/agent/credentials/instancecreds/instancecreds_linux.go +++ b/agent/credentials/instancecreds/instancecreds_linux.go @@ -25,10 +25,10 @@ import ( // GetCredentials returns the instance credentials chain. This is the default chain // credentials plus the "rotating shared credentials provider", so credentials will // be checked in this order: -// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY). -// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key). -// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)). -// 4. Rotating shared credentials file located at /rotatingcreds/credentials +// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY). +// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key). +// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)). +// 4. Rotating shared credentials file located at /rotatingcreds/credentials func GetCredentials(isExternal bool) *credentials.Credentials { mu.Lock() if credentialChain == nil { diff --git a/agent/credentials/instancecreds/instancecreds_unsupported.go b/agent/credentials/instancecreds/instancecreds_unsupported.go index 2691df5e3da..c7c27d44987 100644 --- a/agent/credentials/instancecreds/instancecreds_unsupported.go +++ b/agent/credentials/instancecreds/instancecreds_unsupported.go @@ -23,10 +23,10 @@ import ( // GetCredentials returns the instance credentials chain. This is the default chain // credentials plus the "rotating shared credentials provider", so credentials will // be checked in this order: -// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY). -// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key). -// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)). -// 4. Rotating shared credentials file located at /rotatingcreds/credentials +// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY). +// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key). +// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)). +// 4. Rotating shared credentials file located at /rotatingcreds/credentials func GetCredentials(isExternal bool) *credentials.Credentials { return nil } diff --git a/agent/credentials/instancecreds/instancecreds_windows.go b/agent/credentials/instancecreds/instancecreds_windows.go index 01f12bc13d4..efcd1f9aa74 100644 --- a/agent/credentials/instancecreds/instancecreds_windows.go +++ b/agent/credentials/instancecreds/instancecreds_windows.go @@ -25,21 +25,25 @@ import ( // GetCredentials returns the instance credentials chain. This is the default chain // credentials plus the "rotating shared credentials provider", so credentials will // be checked in this order: -// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY). -// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key). -// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)). -// 4. Rotating shared credentials file located at /rotatingcreds/credentials // -// The default credential chain provided by the SDK includes: -// * EnvProvider -// * SharedCredentialsProvider -// * RemoteCredProvider (EC2RoleProvider) +// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY). // -// In the case of ECS-A on Windows, the `SharedCredentialsProvider` takes -// precedence over the `RotatingSharedCredentialsProvider` and this results -// in the credentials not being refreshed. To mitigate this issue, we will -// reorder the credential chain and ensure that `RotatingSharedCredentialsProvider` -// takes precedence over the `SharedCredentialsProvider` for ECS-A. +// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key). +// +// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)). +// +// 4. Rotating shared credentials file located at /rotatingcreds/credentials +// +// The default credential chain provided by the SDK includes: +// * EnvProvider +// * SharedCredentialsProvider +// * RemoteCredProvider (EC2RoleProvider) +// +// In the case of ECS-A on Windows, the `SharedCredentialsProvider` takes +// precedence over the `RotatingSharedCredentialsProvider` and this results +// in the credentials not being refreshed. To mitigate this issue, we will +// reorder the credential chain and ensure that `RotatingSharedCredentialsProvider` +// takes precedence over the `SharedCredentialsProvider` for ECS-A. func GetCredentials(isExternal bool) *credentials.Credentials { mu.Lock() credProviders := defaults.CredProviders(defaults.Config(), defaults.Handlers()) diff --git a/agent/dockerclient/dockerapi/docker_client.go b/agent/dockerclient/dockerapi/docker_client.go index c5781393666..0837a9f913c 100644 --- a/agent/dockerclient/dockerapi/docker_client.go +++ b/agent/dockerclient/dockerapi/docker_client.go @@ -214,20 +214,21 @@ type DockerClient interface { // DockerGoClient wraps the underlying go-dockerclient and docker/docker library. // It exists primarily for the following four purposes: -// 1) Provide an abstraction over inputs and outputs, -// a) Inputs: Trims them down to what we actually need (largely unchanged tbh) -// b) Outputs: Unifies error handling and the common 'start->inspect' -// pattern by having a consistent error output. This error output -// contains error data with a given Name that aims to be presentable as a -// 'reason' in state changes. It also filters out the information about a -// container that is of interest, such as network bindings, while -// ignoring the rest. -// 2) Timeouts: It adds timeouts everywhere, mostly as a reaction to -// pull-related issues in the Docker daemon. -// 3) Versioning: It abstracts over multiple client versions to allow juggling -// appropriately there. -// 4) Allows for both the go-dockerclient client and Docker SDK client to live -// side-by-side until migration to the Docker SDK is complete. +// 1. Provide an abstraction over inputs and outputs, +// a) Inputs: Trims them down to what we actually need (largely unchanged tbh) +// b) Outputs: Unifies error handling and the common 'start->inspect' +// pattern by having a consistent error output. This error output +// contains error data with a given Name that aims to be presentable as a +// 'reason' in state changes. It also filters out the information about a +// container that is of interest, such as network bindings, while +// ignoring the rest. +// 2. Timeouts: It adds timeouts everywhere, mostly as a reaction to +// pull-related issues in the Docker daemon. +// 3. Versioning: It abstracts over multiple client versions to allow juggling +// appropriately there. +// 4. Allows for both the go-dockerclient client and Docker SDK client to live +// side-by-side until migration to the Docker SDK is complete. +// // Implements DockerClient // TODO Remove clientfactory field once all API calls are migrated to sdkclientFactory type dockerGoClient struct { diff --git a/agent/dockerclient/dockerauth/doc.go b/agent/dockerclient/dockerauth/doc.go index 2ee606d8a07..8d43c81e0ee 100644 --- a/agent/dockerclient/dockerauth/doc.go +++ b/agent/dockerclient/dockerauth/doc.go @@ -15,7 +15,7 @@ Package dockerauth handles storing auth configuration information for Docker registries. -Usage +# Usage This package pulls authentication information from the passed configuration. A user should set the "EngineAuthType" and "EngineAuthData" configuration @@ -24,7 +24,7 @@ keys to values indicated below. These keys may be set by either setting the environment variables "ECS_ENGINE_AUTH_TYPE" and "ECS_ENGINE_AUTH_DATA" or by setting the keys "EngineAuthData" and "EngineAuthType" in the JSON configuration file located at the configured "ECS_AGENT_CONFIG_FILE_PATH" (see http://godoc.org/github.com/aws/amazon-ecs-agent/agent/config) -Auth Types +# Auth Types The two currently supported auth types are "docker" and "dockercfg". @@ -34,6 +34,7 @@ The auth type "docker" is intended to work most naturally with a JSON configuration file. The "AuthData" is a structured JSON object which specifies values for the docker "AuthConfig" structure. The "AuthData" should be an object similar to the following: + { "my.registry.example.com": { "username": "myUsername", @@ -46,13 +47,13 @@ similar to the following: } } - Dockercfg: The auth type "dockercfg" is intended to allow easy use of an existing ".dockercfg" file generated by running "docker login". This auth type expects the "AuthData" to be a string containing the contents of that file. The contents of your ".dockercfg" will generally be a string of the following form: + '{"http://myregistry.com/v1/":{"auth":"dXNlcjpzd29yZGZpc2g=","email":"email"}}' */ package dockerauth diff --git a/agent/ecr/model/ecr/api.go b/agent/ecr/model/ecr/api.go index 9a03b27f87e..6c6fa60d572 100644 --- a/agent/ecr/model/ecr/api.go +++ b/agent/ecr/model/ecr/api.go @@ -41,14 +41,13 @@ const opGetAuthorizationToken = "GetAuthorizationToken" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the GetAuthorizationTokenRequest method. +// req, resp := client.GetAuthorizationTokenRequest(params) // -// // Example sending a request using the GetAuthorizationTokenRequest method. -// req, resp := client.GetAuthorizationTokenRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECR) GetAuthorizationTokenRequest(input *GetAuthorizationTokenInput) (req *request.Request, output *GetAuthorizationTokenOutput) { op := &request.Operation{ Name: opGetAuthorizationToken, @@ -75,10 +74,10 @@ func (c *ECR) GetAuthorizationTokenRequest(input *GetAuthorizationTokenInput) (r // API operation GetAuthorizationToken for usage and error information. // // Returned Error Types: -// * ServerException // -// * InvalidParameterException +// - ServerException // +// - InvalidParameterException func (c *ECR) GetAuthorizationToken(input *GetAuthorizationTokenInput) (*GetAuthorizationTokenOutput, error) { req, out := c.GetAuthorizationTokenRequest(input) return out, req.Send() diff --git a/agent/ecr/model/ecr/service.go b/agent/ecr/model/ecr/service.go index c58f433ab7f..e9477a64107 100644 --- a/agent/ecr/model/ecr/service.go +++ b/agent/ecr/model/ecr/service.go @@ -53,13 +53,14 @@ const ( // aws.Config parameter to add your extra config. // // Example: -// mySession := session.Must(session.NewSession()) // -// // Create a ECR client from just a session. -// svc := ecr.New(mySession) +// mySession := session.Must(session.NewSession()) // -// // Create a ECR client with additional configuration -// svc := ecr.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +// // Create a ECR client from just a session. +// svc := ecr.New(mySession) +// +// // Create a ECR client with additional configuration +// svc := ecr.New(mySession, aws.NewConfig().WithRegion("us-west-2")) func New(p client.ConfigProvider, cfgs ...*aws.Config) *ECR { c := p.ClientConfig(EndpointsID, cfgs...) if c.SigningNameDerived || len(c.SigningName) == 0 { diff --git a/agent/ecs_client/model/ecs/api.go b/agent/ecs_client/model/ecs/api.go index bd9ff756a23..304d3310a3e 100644 --- a/agent/ecs_client/model/ecs/api.go +++ b/agent/ecs_client/model/ecs/api.go @@ -41,14 +41,13 @@ const opCreateCluster = "CreateCluster" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the CreateClusterRequest method. +// req, resp := client.CreateClusterRequest(params) // -// // Example sending a request using the CreateClusterRequest method. -// req, resp := client.CreateClusterRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) CreateClusterRequest(input *CreateClusterInput) (req *request.Request, output *CreateClusterOutput) { op := &request.Operation{ Name: opCreateCluster, @@ -87,18 +86,18 @@ func (c *ECS) CreateClusterRequest(input *CreateClusterInput) (req *request.Requ // API operation CreateCluster for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) CreateCluster(input *CreateClusterInput) (*CreateClusterOutput, error) { req, out := c.CreateClusterRequest(input) return out, req.Send() @@ -136,14 +135,13 @@ const opCreateService = "CreateService" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the CreateServiceRequest method. +// req, resp := client.CreateServiceRequest(params) // -// // Example sending a request using the CreateServiceRequest method. -// req, resp := client.CreateServiceRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) CreateServiceRequest(input *CreateServiceInput) (req *request.Request, output *CreateServiceOutput) { op := &request.Operation{ Name: opCreateService, @@ -208,20 +206,20 @@ func (c *ECS) CreateServiceRequest(input *CreateServiceInput) (req *request.Requ // When the service scheduler launches new tasks, it determines task placement // in your cluster using the following logic: // -// * Determine which of the container instances in your cluster can support -// your service's task definition (for example, they have the required CPU, -// memory, ports, and container instance attributes). -// -// * By default, the service scheduler attempts to balance tasks across Availability -// Zones in this manner (although you can choose a different placement strategy) -// with the placementStrategy parameter): Sort the valid container instances, -// giving priority to instances that have the fewest number of running tasks -// for this service in their respective Availability Zone. For example, if -// zone A has one running service task and zones B and C each have zero, -// valid container instances in either zone B or C are considered optimal -// for placement. Place the new service task on a valid container instance -// in an optimal Availability Zone (based on the previous steps), favoring -// container instances with the fewest number of running tasks for this service. +// - Determine which of the container instances in your cluster can support +// your service's task definition (for example, they have the required CPU, +// memory, ports, and container instance attributes). +// +// - By default, the service scheduler attempts to balance tasks across Availability +// Zones in this manner (although you can choose a different placement strategy) +// with the placementStrategy parameter): Sort the valid container instances, +// giving priority to instances that have the fewest number of running tasks +// for this service in their respective Availability Zone. For example, if +// zone A has one running service task and zones B and C each have zero, +// valid container instances in either zone B or C are considered optimal +// for placement. Place the new service task on a valid container instance +// in an optimal Availability Zone (based on the previous steps), favoring +// container instances with the fewest number of running tasks for this service. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -231,35 +229,35 @@ func (c *ECS) CreateServiceRequest(input *CreateServiceInput) (req *request.Requ // API operation CreateService for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // -// * UnsupportedFeatureException -// The specified task is not supported in this region. +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. // -// * PlatformUnknownException -// The specified platform version does not exist. +// - UnsupportedFeatureException +// The specified task is not supported in this region. // -// * PlatformTaskDefinitionIncompatibilityException -// The specified platform version does not satisfy the task definition's required -// capabilities. +// - PlatformUnknownException +// The specified platform version does not exist. // -// * AccessDeniedException -// You do not have authorization to perform the requested action. +// - PlatformTaskDefinitionIncompatibilityException +// The specified platform version does not satisfy the task definition's required +// capabilities. // +// - AccessDeniedException +// You do not have authorization to perform the requested action. func (c *ECS) CreateService(input *CreateServiceInput) (*CreateServiceOutput, error) { req, out := c.CreateServiceRequest(input) return out, req.Send() @@ -297,14 +295,13 @@ const opDeleteAccountSetting = "DeleteAccountSetting" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DeleteAccountSettingRequest method. +// req, resp := client.DeleteAccountSettingRequest(params) // -// // Example sending a request using the DeleteAccountSettingRequest method. -// req, resp := client.DeleteAccountSettingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DeleteAccountSettingRequest(input *DeleteAccountSettingInput) (req *request.Request, output *DeleteAccountSettingOutput) { op := &request.Operation{ Name: opDeleteAccountSetting, @@ -331,18 +328,18 @@ func (c *ECS) DeleteAccountSettingRequest(input *DeleteAccountSettingInput) (req // API operation DeleteAccountSetting for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) DeleteAccountSetting(input *DeleteAccountSettingInput) (*DeleteAccountSettingOutput, error) { req, out := c.DeleteAccountSettingRequest(input) return out, req.Send() @@ -380,14 +377,13 @@ const opDeleteAttributes = "DeleteAttributes" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DeleteAttributesRequest method. +// req, resp := client.DeleteAttributesRequest(params) // -// // Example sending a request using the DeleteAttributesRequest method. -// req, resp := client.DeleteAttributesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DeleteAttributesRequest(input *DeleteAttributesInput) (req *request.Request, output *DeleteAttributesOutput) { op := &request.Operation{ Name: opDeleteAttributes, @@ -416,19 +412,19 @@ func (c *ECS) DeleteAttributesRequest(input *DeleteAttributesInput) (req *reques // API operation DeleteAttributes for usage and error information. // // Returned Error Types: -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. // -// * TargetNotFoundException -// The specified target could not be found. You can view your available container -// instances with ListContainerInstances. Amazon ECS container instances are -// cluster-specific and region-specific. +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - TargetNotFoundException +// The specified target could not be found. You can view your available container +// instances with ListContainerInstances. Amazon ECS container instances are +// cluster-specific and region-specific. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) DeleteAttributes(input *DeleteAttributesInput) (*DeleteAttributesOutput, error) { req, out := c.DeleteAttributesRequest(input) return out, req.Send() @@ -466,14 +462,13 @@ const opDeleteCluster = "DeleteCluster" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DeleteClusterRequest method. +// req, resp := client.DeleteClusterRequest(params) // -// // Example sending a request using the DeleteClusterRequest method. -// req, resp := client.DeleteClusterRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DeleteClusterRequest(input *DeleteClusterInput) (req *request.Request, output *DeleteClusterOutput) { op := &request.Operation{ Name: opDeleteCluster, @@ -504,35 +499,35 @@ func (c *ECS) DeleteClusterRequest(input *DeleteClusterInput) (req *request.Requ // API operation DeleteCluster for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // -// * ClusterContainsContainerInstancesException -// You cannot delete a cluster that has registered container instances. You -// must first deregister the container instances before you can delete the cluster. -// For more information, see DeregisterContainerInstance. +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. // -// * ClusterContainsServicesException -// You cannot delete a cluster that contains services. You must first update -// the service to reduce its desired task count to 0 and then delete the service. -// For more information, see UpdateService and DeleteService. +// - ClusterContainsContainerInstancesException +// You cannot delete a cluster that has registered container instances. You +// must first deregister the container instances before you can delete the cluster. +// For more information, see DeregisterContainerInstance. // -// * ClusterContainsTasksException -// You cannot delete a cluster that has active tasks. +// - ClusterContainsServicesException +// You cannot delete a cluster that contains services. You must first update +// the service to reduce its desired task count to 0 and then delete the service. +// For more information, see UpdateService and DeleteService. // +// - ClusterContainsTasksException +// You cannot delete a cluster that has active tasks. func (c *ECS) DeleteCluster(input *DeleteClusterInput) (*DeleteClusterOutput, error) { req, out := c.DeleteClusterRequest(input) return out, req.Send() @@ -570,14 +565,13 @@ const opDeleteService = "DeleteService" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DeleteServiceRequest method. +// req, resp := client.DeleteServiceRequest(params) // -// // Example sending a request using the DeleteServiceRequest method. -// req, resp := client.DeleteServiceRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DeleteServiceRequest(input *DeleteServiceInput) (req *request.Request, output *DeleteServiceOutput) { op := &request.Operation{ Name: opDeleteService, @@ -619,26 +613,26 @@ func (c *ECS) DeleteServiceRequest(input *DeleteServiceInput) (req *request.Requ // API operation DeleteService for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // -// * ServiceNotFoundException -// The specified service could not be found. You can view your available services -// with ListServices. Amazon ECS services are cluster-specific and region-specific. +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. // +// - ServiceNotFoundException +// The specified service could not be found. You can view your available services +// with ListServices. Amazon ECS services are cluster-specific and region-specific. func (c *ECS) DeleteService(input *DeleteServiceInput) (*DeleteServiceOutput, error) { req, out := c.DeleteServiceRequest(input) return out, req.Send() @@ -676,14 +670,13 @@ const opDeregisterContainerInstance = "DeregisterContainerInstance" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DeregisterContainerInstanceRequest method. +// req, resp := client.DeregisterContainerInstanceRequest(params) // -// // Example sending a request using the DeregisterContainerInstanceRequest method. -// req, resp := client.DeregisterContainerInstanceRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DeregisterContainerInstanceRequest(input *DeregisterContainerInstanceInput) (req *request.Request, output *DeregisterContainerInstanceOutput) { op := &request.Operation{ Name: opDeregisterContainerInstance, @@ -726,22 +719,22 @@ func (c *ECS) DeregisterContainerInstanceRequest(input *DeregisterContainerInsta // API operation DeregisterContainerInstance for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. func (c *ECS) DeregisterContainerInstance(input *DeregisterContainerInstanceInput) (*DeregisterContainerInstanceOutput, error) { req, out := c.DeregisterContainerInstanceRequest(input) return out, req.Send() @@ -779,14 +772,13 @@ const opDeregisterTaskDefinition = "DeregisterTaskDefinition" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DeregisterTaskDefinitionRequest method. +// req, resp := client.DeregisterTaskDefinitionRequest(params) // -// // Example sending a request using the DeregisterTaskDefinitionRequest method. -// req, resp := client.DeregisterTaskDefinitionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DeregisterTaskDefinitionRequest(input *DeregisterTaskDefinitionInput) (req *request.Request, output *DeregisterTaskDefinitionOutput) { op := &request.Operation{ Name: opDeregisterTaskDefinition, @@ -829,18 +821,18 @@ func (c *ECS) DeregisterTaskDefinitionRequest(input *DeregisterTaskDefinitionInp // API operation DeregisterTaskDefinition for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) DeregisterTaskDefinition(input *DeregisterTaskDefinitionInput) (*DeregisterTaskDefinitionOutput, error) { req, out := c.DeregisterTaskDefinitionRequest(input) return out, req.Send() @@ -878,14 +870,13 @@ const opDescribeClusters = "DescribeClusters" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DescribeClustersRequest method. +// req, resp := client.DescribeClustersRequest(params) // -// // Example sending a request using the DescribeClustersRequest method. -// req, resp := client.DescribeClustersRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DescribeClustersRequest(input *DescribeClustersInput) (req *request.Request, output *DescribeClustersOutput) { op := &request.Operation{ Name: opDescribeClusters, @@ -914,18 +905,18 @@ func (c *ECS) DescribeClustersRequest(input *DescribeClustersInput) (req *reques // API operation DescribeClusters for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) DescribeClusters(input *DescribeClustersInput) (*DescribeClustersOutput, error) { req, out := c.DescribeClustersRequest(input) return out, req.Send() @@ -963,14 +954,13 @@ const opDescribeContainerInstances = "DescribeContainerInstances" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DescribeContainerInstancesRequest method. +// req, resp := client.DescribeContainerInstancesRequest(params) // -// // Example sending a request using the DescribeContainerInstancesRequest method. -// req, resp := client.DescribeContainerInstancesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DescribeContainerInstancesRequest(input *DescribeContainerInstancesInput) (req *request.Request, output *DescribeContainerInstancesOutput) { op := &request.Operation{ Name: opDescribeContainerInstances, @@ -1000,22 +990,22 @@ func (c *ECS) DescribeContainerInstancesRequest(input *DescribeContainerInstance // API operation DescribeContainerInstances for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. func (c *ECS) DescribeContainerInstances(input *DescribeContainerInstancesInput) (*DescribeContainerInstancesOutput, error) { req, out := c.DescribeContainerInstancesRequest(input) return out, req.Send() @@ -1053,14 +1043,13 @@ const opDescribeServices = "DescribeServices" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DescribeServicesRequest method. +// req, resp := client.DescribeServicesRequest(params) // -// // Example sending a request using the DescribeServicesRequest method. -// req, resp := client.DescribeServicesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DescribeServicesRequest(input *DescribeServicesInput) (req *request.Request, output *DescribeServicesOutput) { op := &request.Operation{ Name: opDescribeServices, @@ -1089,22 +1078,22 @@ func (c *ECS) DescribeServicesRequest(input *DescribeServicesInput) (req *reques // API operation DescribeServices for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. func (c *ECS) DescribeServices(input *DescribeServicesInput) (*DescribeServicesOutput, error) { req, out := c.DescribeServicesRequest(input) return out, req.Send() @@ -1142,14 +1131,13 @@ const opDescribeTaskDefinition = "DescribeTaskDefinition" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DescribeTaskDefinitionRequest method. +// req, resp := client.DescribeTaskDefinitionRequest(params) // -// // Example sending a request using the DescribeTaskDefinitionRequest method. -// req, resp := client.DescribeTaskDefinitionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DescribeTaskDefinitionRequest(input *DescribeTaskDefinitionInput) (req *request.Request, output *DescribeTaskDefinitionOutput) { op := &request.Operation{ Name: opDescribeTaskDefinition, @@ -1183,18 +1171,18 @@ func (c *ECS) DescribeTaskDefinitionRequest(input *DescribeTaskDefinitionInput) // API operation DescribeTaskDefinition for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) DescribeTaskDefinition(input *DescribeTaskDefinitionInput) (*DescribeTaskDefinitionOutput, error) { req, out := c.DescribeTaskDefinitionRequest(input) return out, req.Send() @@ -1232,14 +1220,13 @@ const opDescribeTasks = "DescribeTasks" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DescribeTasksRequest method. +// req, resp := client.DescribeTasksRequest(params) // -// // Example sending a request using the DescribeTasksRequest method. -// req, resp := client.DescribeTasksRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DescribeTasksRequest(input *DescribeTasksInput) (req *request.Request, output *DescribeTasksOutput) { op := &request.Operation{ Name: opDescribeTasks, @@ -1268,22 +1255,22 @@ func (c *ECS) DescribeTasksRequest(input *DescribeTasksInput) (req *request.Requ // API operation DescribeTasks for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. func (c *ECS) DescribeTasks(input *DescribeTasksInput) (*DescribeTasksOutput, error) { req, out := c.DescribeTasksRequest(input) return out, req.Send() @@ -1321,14 +1308,13 @@ const opDiscoverPollEndpoint = "DiscoverPollEndpoint" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the DiscoverPollEndpointRequest method. +// req, resp := client.DiscoverPollEndpointRequest(params) // -// // Example sending a request using the DiscoverPollEndpointRequest method. -// req, resp := client.DiscoverPollEndpointRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) DiscoverPollEndpointRequest(input *DiscoverPollEndpointInput) (req *request.Request, output *DiscoverPollEndpointOutput) { op := &request.Operation{ Name: opDiscoverPollEndpoint, @@ -1347,7 +1333,6 @@ func (c *ECS) DiscoverPollEndpointRequest(input *DiscoverPollEndpointInput) (req // DiscoverPollEndpoint API operation for Amazon Elastic Container Service. // -// // This action is only used by the Amazon ECS agent, and it is not intended // for use outside of the agent. // @@ -1361,14 +1346,14 @@ func (c *ECS) DiscoverPollEndpointRequest(input *DiscoverPollEndpointInput) (req // API operation DiscoverPollEndpoint for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. func (c *ECS) DiscoverPollEndpoint(input *DiscoverPollEndpointInput) (*DiscoverPollEndpointOutput, error) { req, out := c.DiscoverPollEndpointRequest(input) return out, req.Send() @@ -1406,14 +1391,13 @@ const opListAttributes = "ListAttributes" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the ListAttributesRequest method. +// req, resp := client.ListAttributesRequest(params) // -// // Example sending a request using the ListAttributesRequest method. -// req, resp := client.ListAttributesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) ListAttributesRequest(input *ListAttributesInput) (req *request.Request, output *ListAttributesOutput) { op := &request.Operation{ Name: opListAttributes, @@ -1448,14 +1432,14 @@ func (c *ECS) ListAttributesRequest(input *ListAttributesInput) (req *request.Re // API operation ListAttributes for usage and error information. // // Returned Error Types: -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) ListAttributes(input *ListAttributesInput) (*ListAttributesOutput, error) { req, out := c.ListAttributesRequest(input) return out, req.Send() @@ -1493,14 +1477,13 @@ const opListClusters = "ListClusters" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the ListClustersRequest method. +// req, resp := client.ListClustersRequest(params) // -// // Example sending a request using the ListClustersRequest method. -// req, resp := client.ListClustersRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) ListClustersRequest(input *ListClustersInput) (req *request.Request, output *ListClustersOutput) { op := &request.Operation{ Name: opListClusters, @@ -1535,18 +1518,18 @@ func (c *ECS) ListClustersRequest(input *ListClustersInput) (req *request.Reques // API operation ListClusters for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) ListClusters(input *ListClustersInput) (*ListClustersOutput, error) { req, out := c.ListClustersRequest(input) return out, req.Send() @@ -1576,15 +1559,14 @@ func (c *ECS) ListClustersWithContext(ctx aws.Context, input *ListClustersInput, // // Note: This operation can generate multiple requests to a service. // -// // Example iterating over at most 3 pages of a ListClusters operation. -// pageNum := 0 -// err := client.ListClustersPages(params, -// func(page *ecs.ListClustersOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// +// // Example iterating over at most 3 pages of a ListClusters operation. +// pageNum := 0 +// err := client.ListClustersPages(params, +// func(page *ecs.ListClustersOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) func (c *ECS) ListClustersPages(input *ListClustersInput, fn func(*ListClustersOutput, bool) bool) error { return c.ListClustersPagesWithContext(aws.BackgroundContext(), input, fn) } @@ -1636,14 +1618,13 @@ const opListContainerInstances = "ListContainerInstances" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the ListContainerInstancesRequest method. +// req, resp := client.ListContainerInstancesRequest(params) // -// // Example sending a request using the ListContainerInstancesRequest method. -// req, resp := client.ListContainerInstancesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) ListContainerInstancesRequest(input *ListContainerInstancesInput) (req *request.Request, output *ListContainerInstancesOutput) { op := &request.Operation{ Name: opListContainerInstances, @@ -1682,22 +1663,22 @@ func (c *ECS) ListContainerInstancesRequest(input *ListContainerInstancesInput) // API operation ListContainerInstances for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. func (c *ECS) ListContainerInstances(input *ListContainerInstancesInput) (*ListContainerInstancesOutput, error) { req, out := c.ListContainerInstancesRequest(input) return out, req.Send() @@ -1727,15 +1708,14 @@ func (c *ECS) ListContainerInstancesWithContext(ctx aws.Context, input *ListCont // // Note: This operation can generate multiple requests to a service. // -// // Example iterating over at most 3 pages of a ListContainerInstances operation. -// pageNum := 0 -// err := client.ListContainerInstancesPages(params, -// func(page *ecs.ListContainerInstancesOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// +// // Example iterating over at most 3 pages of a ListContainerInstances operation. +// pageNum := 0 +// err := client.ListContainerInstancesPages(params, +// func(page *ecs.ListContainerInstancesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) func (c *ECS) ListContainerInstancesPages(input *ListContainerInstancesInput, fn func(*ListContainerInstancesOutput, bool) bool) error { return c.ListContainerInstancesPagesWithContext(aws.BackgroundContext(), input, fn) } @@ -1787,14 +1767,13 @@ const opListServices = "ListServices" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the ListServicesRequest method. +// req, resp := client.ListServicesRequest(params) // -// // Example sending a request using the ListServicesRequest method. -// req, resp := client.ListServicesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) ListServicesRequest(input *ListServicesInput) (req *request.Request, output *ListServicesOutput) { op := &request.Operation{ Name: opListServices, @@ -1829,22 +1808,22 @@ func (c *ECS) ListServicesRequest(input *ListServicesInput) (req *request.Reques // API operation ListServices for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. func (c *ECS) ListServices(input *ListServicesInput) (*ListServicesOutput, error) { req, out := c.ListServicesRequest(input) return out, req.Send() @@ -1874,15 +1853,14 @@ func (c *ECS) ListServicesWithContext(ctx aws.Context, input *ListServicesInput, // // Note: This operation can generate multiple requests to a service. // -// // Example iterating over at most 3 pages of a ListServices operation. -// pageNum := 0 -// err := client.ListServicesPages(params, -// func(page *ecs.ListServicesOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// +// // Example iterating over at most 3 pages of a ListServices operation. +// pageNum := 0 +// err := client.ListServicesPages(params, +// func(page *ecs.ListServicesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) func (c *ECS) ListServicesPages(input *ListServicesInput, fn func(*ListServicesOutput, bool) bool) error { return c.ListServicesPagesWithContext(aws.BackgroundContext(), input, fn) } @@ -1934,14 +1912,13 @@ const opListTagsForResource = "ListTagsForResource" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the ListTagsForResourceRequest method. +// req, resp := client.ListTagsForResourceRequest(params) // -// // Example sending a request using the ListTagsForResourceRequest method. -// req, resp := client.ListTagsForResourceRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req *request.Request, output *ListTagsForResourceOutput) { op := &request.Operation{ Name: opListTagsForResource, @@ -1968,22 +1945,22 @@ func (c *ECS) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req * // API operation ListTagsForResource for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { req, out := c.ListTagsForResourceRequest(input) return out, req.Send() @@ -2021,14 +1998,13 @@ const opListTaskDefinitionFamilies = "ListTaskDefinitionFamilies" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the ListTaskDefinitionFamiliesRequest method. +// req, resp := client.ListTaskDefinitionFamiliesRequest(params) // -// // Example sending a request using the ListTaskDefinitionFamiliesRequest method. -// req, resp := client.ListTaskDefinitionFamiliesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) ListTaskDefinitionFamiliesRequest(input *ListTaskDefinitionFamiliesInput) (req *request.Request, output *ListTaskDefinitionFamiliesOutput) { op := &request.Operation{ Name: opListTaskDefinitionFamilies, @@ -2069,18 +2045,18 @@ func (c *ECS) ListTaskDefinitionFamiliesRequest(input *ListTaskDefinitionFamilie // API operation ListTaskDefinitionFamilies for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) ListTaskDefinitionFamilies(input *ListTaskDefinitionFamiliesInput) (*ListTaskDefinitionFamiliesOutput, error) { req, out := c.ListTaskDefinitionFamiliesRequest(input) return out, req.Send() @@ -2110,15 +2086,14 @@ func (c *ECS) ListTaskDefinitionFamiliesWithContext(ctx aws.Context, input *List // // Note: This operation can generate multiple requests to a service. // -// // Example iterating over at most 3 pages of a ListTaskDefinitionFamilies operation. -// pageNum := 0 -// err := client.ListTaskDefinitionFamiliesPages(params, -// func(page *ecs.ListTaskDefinitionFamiliesOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// +// // Example iterating over at most 3 pages of a ListTaskDefinitionFamilies operation. +// pageNum := 0 +// err := client.ListTaskDefinitionFamiliesPages(params, +// func(page *ecs.ListTaskDefinitionFamiliesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) func (c *ECS) ListTaskDefinitionFamiliesPages(input *ListTaskDefinitionFamiliesInput, fn func(*ListTaskDefinitionFamiliesOutput, bool) bool) error { return c.ListTaskDefinitionFamiliesPagesWithContext(aws.BackgroundContext(), input, fn) } @@ -2170,14 +2145,13 @@ const opListTaskDefinitions = "ListTaskDefinitions" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the ListTaskDefinitionsRequest method. +// req, resp := client.ListTaskDefinitionsRequest(params) // -// // Example sending a request using the ListTaskDefinitionsRequest method. -// req, resp := client.ListTaskDefinitionsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) ListTaskDefinitionsRequest(input *ListTaskDefinitionsInput) (req *request.Request, output *ListTaskDefinitionsOutput) { op := &request.Operation{ Name: opListTaskDefinitions, @@ -2214,18 +2188,18 @@ func (c *ECS) ListTaskDefinitionsRequest(input *ListTaskDefinitionsInput) (req * // API operation ListTaskDefinitions for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) ListTaskDefinitions(input *ListTaskDefinitionsInput) (*ListTaskDefinitionsOutput, error) { req, out := c.ListTaskDefinitionsRequest(input) return out, req.Send() @@ -2255,15 +2229,14 @@ func (c *ECS) ListTaskDefinitionsWithContext(ctx aws.Context, input *ListTaskDef // // Note: This operation can generate multiple requests to a service. // -// // Example iterating over at most 3 pages of a ListTaskDefinitions operation. -// pageNum := 0 -// err := client.ListTaskDefinitionsPages(params, -// func(page *ecs.ListTaskDefinitionsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// +// // Example iterating over at most 3 pages of a ListTaskDefinitions operation. +// pageNum := 0 +// err := client.ListTaskDefinitionsPages(params, +// func(page *ecs.ListTaskDefinitionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) func (c *ECS) ListTaskDefinitionsPages(input *ListTaskDefinitionsInput, fn func(*ListTaskDefinitionsOutput, bool) bool) error { return c.ListTaskDefinitionsPagesWithContext(aws.BackgroundContext(), input, fn) } @@ -2315,14 +2288,13 @@ const opListTasks = "ListTasks" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the ListTasksRequest method. +// req, resp := client.ListTasksRequest(params) // -// // Example sending a request using the ListTasksRequest method. -// req, resp := client.ListTasksRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) ListTasksRequest(input *ListTasksInput) (req *request.Request, output *ListTasksOutput) { op := &request.Operation{ Name: opListTasks, @@ -2362,26 +2334,26 @@ func (c *ECS) ListTasksRequest(input *ListTasksInput) (req *request.Request, out // API operation ListTasks for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // -// * ServiceNotFoundException -// The specified service could not be found. You can view your available services -// with ListServices. Amazon ECS services are cluster-specific and region-specific. +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. // +// - ServiceNotFoundException +// The specified service could not be found. You can view your available services +// with ListServices. Amazon ECS services are cluster-specific and region-specific. func (c *ECS) ListTasks(input *ListTasksInput) (*ListTasksOutput, error) { req, out := c.ListTasksRequest(input) return out, req.Send() @@ -2411,15 +2383,14 @@ func (c *ECS) ListTasksWithContext(ctx aws.Context, input *ListTasksInput, opts // // Note: This operation can generate multiple requests to a service. // -// // Example iterating over at most 3 pages of a ListTasks operation. -// pageNum := 0 -// err := client.ListTasksPages(params, -// func(page *ecs.ListTasksOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// +// // Example iterating over at most 3 pages of a ListTasks operation. +// pageNum := 0 +// err := client.ListTasksPages(params, +// func(page *ecs.ListTasksOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) func (c *ECS) ListTasksPages(input *ListTasksInput, fn func(*ListTasksOutput, bool) bool) error { return c.ListTasksPagesWithContext(aws.BackgroundContext(), input, fn) } @@ -2471,14 +2442,13 @@ const opPutAccountSetting = "PutAccountSetting" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the PutAccountSettingRequest method. +// req, resp := client.PutAccountSettingRequest(params) // -// // Example sending a request using the PutAccountSettingRequest method. -// req, resp := client.PutAccountSettingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) PutAccountSettingRequest(input *PutAccountSettingInput) (req *request.Request, output *PutAccountSettingOutput) { op := &request.Operation{ Name: opPutAccountSetting, @@ -2505,18 +2475,18 @@ func (c *ECS) PutAccountSettingRequest(input *PutAccountSettingInput) (req *requ // API operation PutAccountSetting for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) PutAccountSetting(input *PutAccountSettingInput) (*PutAccountSettingOutput, error) { req, out := c.PutAccountSettingRequest(input) return out, req.Send() @@ -2554,14 +2524,13 @@ const opPutAttributes = "PutAttributes" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the PutAttributesRequest method. +// req, resp := client.PutAttributesRequest(params) // -// // Example sending a request using the PutAttributesRequest method. -// req, resp := client.PutAttributesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) PutAttributesRequest(input *PutAttributesInput) (req *request.Request, output *PutAttributesOutput) { op := &request.Operation{ Name: opPutAttributes, @@ -2594,24 +2563,24 @@ func (c *ECS) PutAttributesRequest(input *PutAttributesInput) (req *request.Requ // API operation PutAttributes for usage and error information. // // Returned Error Types: -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. // -// * TargetNotFoundException -// The specified target could not be found. You can view your available container -// instances with ListContainerInstances. Amazon ECS container instances are -// cluster-specific and region-specific. +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. // -// * AttributeLimitExceededException -// You can apply up to 10 custom attributes per resource. You can view the attributes -// of a resource with ListAttributes. You can remove existing attributes on -// a resource with DeleteAttributes. +// - TargetNotFoundException +// The specified target could not be found. You can view your available container +// instances with ListContainerInstances. Amazon ECS container instances are +// cluster-specific and region-specific. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - AttributeLimitExceededException +// You can apply up to 10 custom attributes per resource. You can view the attributes +// of a resource with ListAttributes. You can remove existing attributes on +// a resource with DeleteAttributes. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) PutAttributes(input *PutAttributesInput) (*PutAttributesOutput, error) { req, out := c.PutAttributesRequest(input) return out, req.Send() @@ -2649,14 +2618,13 @@ const opRegisterContainerInstance = "RegisterContainerInstance" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the RegisterContainerInstanceRequest method. +// req, resp := client.RegisterContainerInstanceRequest(params) // -// // Example sending a request using the RegisterContainerInstanceRequest method. -// req, resp := client.RegisterContainerInstanceRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) RegisterContainerInstanceRequest(input *RegisterContainerInstanceInput) (req *request.Request, output *RegisterContainerInstanceOutput) { op := &request.Operation{ Name: opRegisterContainerInstance, @@ -2675,7 +2643,6 @@ func (c *ECS) RegisterContainerInstanceRequest(input *RegisterContainerInstanceI // RegisterContainerInstance API operation for Amazon Elastic Container Service. // -// // This action is only used by the Amazon ECS agent, and it is not intended // for use outside of the agent. // @@ -2690,18 +2657,18 @@ func (c *ECS) RegisterContainerInstanceRequest(input *RegisterContainerInstanceI // API operation RegisterContainerInstance for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) RegisterContainerInstance(input *RegisterContainerInstanceInput) (*RegisterContainerInstanceOutput, error) { req, out := c.RegisterContainerInstanceRequest(input) return out, req.Send() @@ -2739,14 +2706,13 @@ const opRegisterTaskDefinition = "RegisterTaskDefinition" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the RegisterTaskDefinitionRequest method. +// req, resp := client.RegisterTaskDefinitionRequest(params) // -// // Example sending a request using the RegisterTaskDefinitionRequest method. -// req, resp := client.RegisterTaskDefinitionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) RegisterTaskDefinitionRequest(input *RegisterTaskDefinitionInput) (req *request.Request, output *RegisterTaskDefinitionOutput) { op := &request.Operation{ Name: opRegisterTaskDefinition, @@ -2795,18 +2761,18 @@ func (c *ECS) RegisterTaskDefinitionRequest(input *RegisterTaskDefinitionInput) // API operation RegisterTaskDefinition for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) RegisterTaskDefinition(input *RegisterTaskDefinitionInput) (*RegisterTaskDefinitionOutput, error) { req, out := c.RegisterTaskDefinitionRequest(input) return out, req.Send() @@ -2844,14 +2810,13 @@ const opRunTask = "RunTask" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the RunTaskRequest method. +// req, resp := client.RunTaskRequest(params) // -// // Example sending a request using the RunTaskRequest method. -// req, resp := client.RunTaskRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) RunTaskRequest(input *RunTaskInput) (req *request.Request, output *RunTaskOutput) { op := &request.Operation{ Name: opRunTask, @@ -2889,17 +2854,17 @@ func (c *ECS) RunTaskRequest(input *RunTaskInput) (req *request.Request, output // // To manage eventual consistency, you can do the following: // -// * Confirm the state of the resource before you run a command to modify -// it. Run the DescribeTasks command using an exponential backoff algorithm -// to ensure that you allow enough time for the previous command to propagate -// through the system. To do this, run the DescribeTasks command repeatedly, -// starting with a couple of seconds of wait time and increasing gradually -// up to five minutes of wait time. +// - Confirm the state of the resource before you run a command to modify +// it. Run the DescribeTasks command using an exponential backoff algorithm +// to ensure that you allow enough time for the previous command to propagate +// through the system. To do this, run the DescribeTasks command repeatedly, +// starting with a couple of seconds of wait time and increasing gradually +// up to five minutes of wait time. // -// * Add wait time between subsequent commands, even if the DescribeTasks -// command returns an accurate response. Apply an exponential backoff algorithm -// starting with a couple of seconds of wait time, and increase gradually -// up to about five minutes of wait time. +// - Add wait time between subsequent commands, even if the DescribeTasks +// command returns an accurate response. Apply an exponential backoff algorithm +// starting with a couple of seconds of wait time, and increase gradually +// up to about five minutes of wait time. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2909,39 +2874,39 @@ func (c *ECS) RunTaskRequest(input *RunTaskInput) (req *request.Request, output // API operation RunTask for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // -// * UnsupportedFeatureException -// The specified task is not supported in this region. +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. // -// * PlatformUnknownException -// The specified platform version does not exist. +// - UnsupportedFeatureException +// The specified task is not supported in this region. // -// * PlatformTaskDefinitionIncompatibilityException -// The specified platform version does not satisfy the task definition's required -// capabilities. +// - PlatformUnknownException +// The specified platform version does not exist. // -// * AccessDeniedException -// You do not have authorization to perform the requested action. +// - PlatformTaskDefinitionIncompatibilityException +// The specified platform version does not satisfy the task definition's required +// capabilities. // -// * BlockedException -// Your AWS account has been blocked. Contact AWS Support (http://aws.amazon.com/contact-us/) -// for more information. +// - AccessDeniedException +// You do not have authorization to perform the requested action. // +// - BlockedException +// Your AWS account has been blocked. Contact AWS Support (http://aws.amazon.com/contact-us/) +// for more information. func (c *ECS) RunTask(input *RunTaskInput) (*RunTaskOutput, error) { req, out := c.RunTaskRequest(input) return out, req.Send() @@ -2979,14 +2944,13 @@ const opStartTask = "StartTask" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the StartTaskRequest method. +// req, resp := client.StartTaskRequest(params) // -// // Example sending a request using the StartTaskRequest method. -// req, resp := client.StartTaskRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) StartTaskRequest(input *StartTaskInput) (req *request.Request, output *StartTaskOutput) { op := &request.Operation{ Name: opStartTask, @@ -3020,22 +2984,22 @@ func (c *ECS) StartTaskRequest(input *StartTaskInput) (req *request.Request, out // API operation StartTask for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. func (c *ECS) StartTask(input *StartTaskInput) (*StartTaskOutput, error) { req, out := c.StartTaskRequest(input) return out, req.Send() @@ -3073,14 +3037,13 @@ const opStopTask = "StopTask" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the StopTaskRequest method. +// req, resp := client.StopTaskRequest(params) // -// // Example sending a request using the StopTaskRequest method. -// req, resp := client.StopTaskRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) StopTaskRequest(input *StopTaskInput) (req *request.Request, output *StopTaskOutput) { op := &request.Operation{ Name: opStopTask, @@ -3120,22 +3083,22 @@ func (c *ECS) StopTaskRequest(input *StopTaskInput) (req *request.Request, outpu // API operation StopTask for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. func (c *ECS) StopTask(input *StopTaskInput) (*StopTaskOutput, error) { req, out := c.StopTaskRequest(input) return out, req.Send() @@ -3173,14 +3136,13 @@ const opSubmitAttachmentStateChanges = "SubmitAttachmentStateChanges" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the SubmitAttachmentStateChangesRequest method. +// req, resp := client.SubmitAttachmentStateChangesRequest(params) // -// // Example sending a request using the SubmitAttachmentStateChangesRequest method. -// req, resp := client.SubmitAttachmentStateChangesRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) SubmitAttachmentStateChangesRequest(input *SubmitAttachmentStateChangesInput) (req *request.Request, output *SubmitAttachmentStateChangesOutput) { op := &request.Operation{ Name: opSubmitAttachmentStateChanges, @@ -3207,21 +3169,21 @@ func (c *ECS) SubmitAttachmentStateChangesRequest(input *SubmitAttachmentStateCh // API operation SubmitAttachmentStateChanges for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * AccessDeniedException -// You do not have authorization to perform the requested action. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - AccessDeniedException +// You do not have authorization to perform the requested action. // +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. func (c *ECS) SubmitAttachmentStateChanges(input *SubmitAttachmentStateChangesInput) (*SubmitAttachmentStateChangesOutput, error) { req, out := c.SubmitAttachmentStateChangesRequest(input) return out, req.Send() @@ -3259,14 +3221,13 @@ const opSubmitContainerStateChange = "SubmitContainerStateChange" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the SubmitContainerStateChangeRequest method. +// req, resp := client.SubmitContainerStateChangeRequest(params) // -// // Example sending a request using the SubmitContainerStateChangeRequest method. -// req, resp := client.SubmitContainerStateChangeRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) SubmitContainerStateChangeRequest(input *SubmitContainerStateChangeInput) (req *request.Request, output *SubmitContainerStateChangeOutput) { op := &request.Operation{ Name: opSubmitContainerStateChange, @@ -3285,7 +3246,6 @@ func (c *ECS) SubmitContainerStateChangeRequest(input *SubmitContainerStateChang // SubmitContainerStateChange API operation for Amazon Elastic Container Service. // -// // This action is only used by the Amazon ECS agent, and it is not intended // for use outside of the agent. // @@ -3299,17 +3259,17 @@ func (c *ECS) SubmitContainerStateChangeRequest(input *SubmitContainerStateChang // API operation SubmitContainerStateChange for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * AccessDeniedException -// You do not have authorization to perform the requested action. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - AccessDeniedException +// You do not have authorization to perform the requested action. func (c *ECS) SubmitContainerStateChange(input *SubmitContainerStateChangeInput) (*SubmitContainerStateChangeOutput, error) { req, out := c.SubmitContainerStateChangeRequest(input) return out, req.Send() @@ -3347,14 +3307,13 @@ const opSubmitTaskStateChange = "SubmitTaskStateChange" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the SubmitTaskStateChangeRequest method. +// req, resp := client.SubmitTaskStateChangeRequest(params) // -// // Example sending a request using the SubmitTaskStateChangeRequest method. -// req, resp := client.SubmitTaskStateChangeRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) SubmitTaskStateChangeRequest(input *SubmitTaskStateChangeInput) (req *request.Request, output *SubmitTaskStateChangeOutput) { op := &request.Operation{ Name: opSubmitTaskStateChange, @@ -3373,7 +3332,6 @@ func (c *ECS) SubmitTaskStateChangeRequest(input *SubmitTaskStateChangeInput) (r // SubmitTaskStateChange API operation for Amazon Elastic Container Service. // -// // This action is only used by the Amazon ECS agent, and it is not intended // for use outside of the agent. // @@ -3387,17 +3345,17 @@ func (c *ECS) SubmitTaskStateChangeRequest(input *SubmitTaskStateChangeInput) (r // API operation SubmitTaskStateChange for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * AccessDeniedException -// You do not have authorization to perform the requested action. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // +// - AccessDeniedException +// You do not have authorization to perform the requested action. func (c *ECS) SubmitTaskStateChange(input *SubmitTaskStateChangeInput) (*SubmitTaskStateChangeOutput, error) { req, out := c.SubmitTaskStateChangeRequest(input) return out, req.Send() @@ -3435,14 +3393,13 @@ const opUpdateContainerAgent = "UpdateContainerAgent" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the UpdateContainerAgentRequest method. +// req, resp := client.UpdateContainerAgentRequest(params) // -// // Example sending a request using the UpdateContainerAgentRequest method. -// req, resp := client.UpdateContainerAgentRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) UpdateContainerAgentRequest(input *UpdateContainerAgentInput) (req *request.Request, output *UpdateContainerAgentOutput) { op := &request.Operation{ Name: opUpdateContainerAgent, @@ -3481,40 +3438,40 @@ func (c *ECS) UpdateContainerAgentRequest(input *UpdateContainerAgentInput) (req // API operation UpdateContainerAgent for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. -// -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. -// -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. -// -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. -// -// * UpdateInProgressException -// There is already a current Amazon ECS container agent update in progress -// on the specified container instance. If the container agent becomes disconnected -// while it is in a transitional stage, such as PENDING or STAGING, the update -// process can get stuck in that state. However, when the agent reconnects, -// it resumes where it stopped previously. -// -// * NoUpdateAvailableException -// There is no update available for this Amazon ECS container agent. This could -// be because the agent is already running the latest version, or it is so old -// that there is no update path to the current version. -// -// * MissingVersionException -// Amazon ECS is unable to determine the current version of the Amazon ECS container -// agent on the container instance and does not have enough information to proceed -// with an update. This could be because the agent running on the container -// instance is an older or custom version that does not use our version information. // +// - ServerException +// These errors are usually caused by a server issue. +// +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. +// +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. +// +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. +// +// - UpdateInProgressException +// There is already a current Amazon ECS container agent update in progress +// on the specified container instance. If the container agent becomes disconnected +// while it is in a transitional stage, such as PENDING or STAGING, the update +// process can get stuck in that state. However, when the agent reconnects, +// it resumes where it stopped previously. +// +// - NoUpdateAvailableException +// There is no update available for this Amazon ECS container agent. This could +// be because the agent is already running the latest version, or it is so old +// that there is no update path to the current version. +// +// - MissingVersionException +// Amazon ECS is unable to determine the current version of the Amazon ECS container +// agent on the container instance and does not have enough information to proceed +// with an update. This could be because the agent running on the container +// instance is an older or custom version that does not use our version information. func (c *ECS) UpdateContainerAgent(input *UpdateContainerAgentInput) (*UpdateContainerAgentOutput, error) { req, out := c.UpdateContainerAgentRequest(input) return out, req.Send() @@ -3552,14 +3509,13 @@ const opUpdateContainerInstancesState = "UpdateContainerInstancesState" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the UpdateContainerInstancesStateRequest method. +// req, resp := client.UpdateContainerInstancesStateRequest(params) // -// // Example sending a request using the UpdateContainerInstancesStateRequest method. -// req, resp := client.UpdateContainerInstancesStateRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) UpdateContainerInstancesStateRequest(input *UpdateContainerInstancesStateInput) (req *request.Request, output *UpdateContainerInstancesStateOutput) { op := &request.Operation{ Name: opUpdateContainerInstancesState, @@ -3595,24 +3551,24 @@ func (c *ECS) UpdateContainerInstancesStateRequest(input *UpdateContainerInstanc // parameters, minimumHealthyPercent and maximumPercent. You can change the // deployment configuration of your service using UpdateService. // -// * If minimumHealthyPercent is below 100%, the scheduler can ignore desiredCount -// temporarily during task replacement. For example, desiredCount is four -// tasks, a minimum of 50% allows the scheduler to stop two existing tasks -// before starting two new tasks. If the minimum is 100%, the service scheduler -// can't remove existing tasks until the replacement tasks are considered -// healthy. Tasks for services that do not use a load balancer are considered -// healthy if they are in the RUNNING state. Tasks for services that use -// a load balancer are considered healthy if they are in the RUNNING state -// and the container instance they are hosted on is reported as healthy by -// the load balancer. -// -// * The maximumPercent parameter represents an upper limit on the number -// of running tasks during task replacement, which enables you to define -// the replacement batch size. For example, if desiredCount of four tasks, -// a maximum of 200% starts four new tasks before stopping the four tasks -// to be drained (provided that the cluster resources required to do this -// are available). If the maximum is 100%, then replacement tasks can't start -// until the draining tasks have stopped. +// - If minimumHealthyPercent is below 100%, the scheduler can ignore desiredCount +// temporarily during task replacement. For example, desiredCount is four +// tasks, a minimum of 50% allows the scheduler to stop two existing tasks +// before starting two new tasks. If the minimum is 100%, the service scheduler +// can't remove existing tasks until the replacement tasks are considered +// healthy. Tasks for services that do not use a load balancer are considered +// healthy if they are in the RUNNING state. Tasks for services that use +// a load balancer are considered healthy if they are in the RUNNING state +// and the container instance they are hosted on is reported as healthy by +// the load balancer. +// +// - The maximumPercent parameter represents an upper limit on the number +// of running tasks during task replacement, which enables you to define +// the replacement batch size. For example, if desiredCount of four tasks, +// a maximum of 200% starts four new tasks before stopping the four tasks +// to be drained (provided that the cluster resources required to do this +// are available). If the maximum is 100%, then replacement tasks can't start +// until the draining tasks have stopped. // // Any PENDING or RUNNING tasks that do not belong to a service are not affected; // you must wait for them to finish or stop them manually. @@ -3631,22 +3587,22 @@ func (c *ECS) UpdateContainerInstancesStateRequest(input *UpdateContainerInstanc // API operation UpdateContainerInstancesState for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. func (c *ECS) UpdateContainerInstancesState(input *UpdateContainerInstancesStateInput) (*UpdateContainerInstancesStateOutput, error) { req, out := c.UpdateContainerInstancesStateRequest(input) return out, req.Send() @@ -3684,14 +3640,13 @@ const opUpdateService = "UpdateService" // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // +// // Example sending a request using the UpdateServiceRequest method. +// req, resp := client.UpdateServiceRequest(params) // -// // Example sending a request using the UpdateServiceRequest method. -// req, resp := client.UpdateServiceRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } func (c *ECS) UpdateServiceRequest(input *UpdateServiceInput) (req *request.Request, output *UpdateServiceOutput) { op := &request.Operation{ Name: opUpdateService, @@ -3734,20 +3689,20 @@ func (c *ECS) UpdateServiceRequest(input *UpdateServiceInput) (req *request.Requ // uses the deployment configuration parameters, minimumHealthyPercent and maximumPercent, // to determine the deployment strategy. // -// * If minimumHealthyPercent is below 100%, the scheduler can ignore desiredCount -// temporarily during a deployment. For example, if desiredCount is four -// tasks, a minimum of 50% allows the scheduler to stop two existing tasks -// before starting two new tasks. Tasks for services that do not use a load -// balancer are considered healthy if they are in the RUNNING state. Tasks -// for services that use a load balancer are considered healthy if they are -// in the RUNNING state and the container instance they are hosted on is -// reported as healthy by the load balancer. -// -// * The maximumPercent parameter represents an upper limit on the number -// of running tasks during a deployment, which enables you to define the -// deployment batch size. For example, if desiredCount is four tasks, a maximum -// of 200% starts four new tasks before stopping the four older tasks (provided -// that the cluster resources required to do this are available). +// - If minimumHealthyPercent is below 100%, the scheduler can ignore desiredCount +// temporarily during a deployment. For example, if desiredCount is four +// tasks, a minimum of 50% allows the scheduler to stop two existing tasks +// before starting two new tasks. Tasks for services that do not use a load +// balancer are considered healthy if they are in the RUNNING state. Tasks +// for services that use a load balancer are considered healthy if they are +// in the RUNNING state and the container instance they are hosted on is +// reported as healthy by the load balancer. +// +// - The maximumPercent parameter represents an upper limit on the number +// of running tasks during a deployment, which enables you to define the +// deployment batch size. For example, if desiredCount is four tasks, a maximum +// of 200% starts four new tasks before stopping the four older tasks (provided +// that the cluster resources required to do this are available). // // When UpdateService stops a task during a deployment, the equivalent of docker // stop is issued to the containers running in the task. This results in a SIGTERM @@ -3758,31 +3713,31 @@ func (c *ECS) UpdateServiceRequest(input *UpdateServiceInput) (req *request.Requ // When the service scheduler launches new tasks, it determines task placement // in your cluster with the following logic: // -// * Determine which of the container instances in your cluster can support -// your service's task definition (for example, they have the required CPU, -// memory, ports, and container instance attributes). +// - Determine which of the container instances in your cluster can support +// your service's task definition (for example, they have the required CPU, +// memory, ports, and container instance attributes). // -// * By default, the service scheduler attempts to balance tasks across Availability -// Zones in this manner (although you can choose a different placement strategy): -// Sort the valid container instances by the fewest number of running tasks -// for this service in the same Availability Zone as the instance. For example, -// if zone A has one running service task and zones B and C each have zero, -// valid container instances in either zone B or C are considered optimal -// for placement. Place the new service task on a valid container instance -// in an optimal Availability Zone (based on the previous steps), favoring -// container instances with the fewest number of running tasks for this service. +// - By default, the service scheduler attempts to balance tasks across Availability +// Zones in this manner (although you can choose a different placement strategy): +// Sort the valid container instances by the fewest number of running tasks +// for this service in the same Availability Zone as the instance. For example, +// if zone A has one running service task and zones B and C each have zero, +// valid container instances in either zone B or C are considered optimal +// for placement. Place the new service task on a valid container instance +// in an optimal Availability Zone (based on the previous steps), favoring +// container instances with the fewest number of running tasks for this service. // // When the service scheduler stops running tasks, it attempts to maintain balance // across the Availability Zones in your cluster using the following logic: // -// * Sort the container instances by the largest number of running tasks -// for this service in the same Availability Zone as the instance. For example, -// if zone A has one running service task and zones B and C each have two, -// container instances in either zone B or C are considered optimal for termination. +// - Sort the container instances by the largest number of running tasks +// for this service in the same Availability Zone as the instance. For example, +// if zone A has one running service task and zones B and C each have two, +// container instances in either zone B or C are considered optimal for termination. // -// * Stop the task on a container instance in an optimal Availability Zone -// (based on the previous steps), favoring container instances with the largest -// number of running tasks for this service. +// - Stop the task on a container instance in an optimal Availability Zone +// (based on the previous steps), favoring container instances with the largest +// number of running tasks for this service. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -3792,40 +3747,40 @@ func (c *ECS) UpdateServiceRequest(input *UpdateServiceInput) (req *request.Requ // API operation UpdateService for usage and error information. // // Returned Error Types: -// * ServerException -// These errors are usually caused by a server issue. // -// * ClientException -// These errors are usually caused by a client action, such as using an action -// or resource on behalf of a user that doesn't have permissions to use the -// action or resource, or specifying an identifier that is not valid. +// - ServerException +// These errors are usually caused by a server issue. // -// * InvalidParameterException -// The specified parameter is invalid. Review the available parameters for the -// API request. +// - ClientException +// These errors are usually caused by a client action, such as using an action +// or resource on behalf of a user that doesn't have permissions to use the +// action or resource, or specifying an identifier that is not valid. // -// * ClusterNotFoundException -// The specified cluster could not be found. You can view your available clusters -// with ListClusters. Amazon ECS clusters are region-specific. +// - InvalidParameterException +// The specified parameter is invalid. Review the available parameters for the +// API request. // -// * ServiceNotFoundException -// The specified service could not be found. You can view your available services -// with ListServices. Amazon ECS services are cluster-specific and region-specific. +// - ClusterNotFoundException +// The specified cluster could not be found. You can view your available clusters +// with ListClusters. Amazon ECS clusters are region-specific. // -// * ServiceNotActiveException -// The specified service is not active. You can't update a service that is inactive. -// If you have previously deleted a service, you can re-create it with CreateService. +// - ServiceNotFoundException +// The specified service could not be found. You can view your available services +// with ListServices. Amazon ECS services are cluster-specific and region-specific. // -// * PlatformUnknownException -// The specified platform version does not exist. +// - ServiceNotActiveException +// The specified service is not active. You can't update a service that is inactive. +// If you have previously deleted a service, you can re-create it with CreateService. // -// * PlatformTaskDefinitionIncompatibilityException -// The specified platform version does not satisfy the task definition's required -// capabilities. +// - PlatformUnknownException +// The specified platform version does not exist. // -// * AccessDeniedException -// You do not have authorization to perform the requested action. +// - PlatformTaskDefinitionIncompatibilityException +// The specified platform version does not satisfy the task definition's required +// capabilities. // +// - AccessDeniedException +// You do not have authorization to perform the requested action. func (c *ECS) UpdateService(input *UpdateServiceInput) (*UpdateServiceOutput, error) { req, out := c.UpdateServiceRequest(input) return out, req.Send() diff --git a/agent/ecs_client/model/ecs/service.go b/agent/ecs_client/model/ecs/service.go index 0dc4c59775c..fa30959a632 100644 --- a/agent/ecs_client/model/ecs/service.go +++ b/agent/ecs_client/model/ecs/service.go @@ -53,13 +53,14 @@ const ( // aws.Config parameter to add your extra config. // // Example: -// mySession := session.Must(session.NewSession()) // -// // Create a ECS client from just a session. -// svc := ecs.New(mySession) +// mySession := session.Must(session.NewSession()) // -// // Create a ECS client with additional configuration -// svc := ecs.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +// // Create a ECS client from just a session. +// svc := ecs.New(mySession) +// +// // Create a ECS client with additional configuration +// svc := ecs.New(mySession, aws.NewConfig().WithRegion("us-west-2")) func New(p client.ConfigProvider, cfgs ...*aws.Config) *ECS { c := p.ClientConfig(EndpointsID, cfgs...) return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName) diff --git a/agent/ecscni/types_linux.go b/agent/ecscni/types_linux.go index 729acac38ff..ba36320b970 100644 --- a/agent/ecscni/types_linux.go +++ b/agent/ecscni/types_linux.go @@ -47,7 +47,7 @@ const ( defaultNetworkName = "network-name" ) -//IPAMNetworkConfig is the config format accepted by the plugin +// IPAMNetworkConfig is the config format accepted by the plugin type IPAMNetworkConfig struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` diff --git a/agent/engine/common_integ_test.go b/agent/engine/common_integ_test.go index 73d9c7e4893..a16e6f7fb9a 100644 --- a/agent/engine/common_integ_test.go +++ b/agent/engine/common_integ_test.go @@ -212,13 +212,14 @@ func waitForTaskCleanup(t *testing.T, taskEngine TaskEngine, taskArn string, sec // Organized first by EventType (Task or Container), // then by StatusType (i.e. RUNNING, STOPPED, etc) // then by Task/Container identifying string (TaskARN or ContainerName) -// EventType -// / \ -// TaskEvent ContainerEvent -// / \ / \ -// RUNNING STOPPED RUNNING STOPPED -// / \ / \ | | -// ARN1 ARN2 ARN3 ARN4 ARN:Cont1 ARN:Cont2 +// +// EventType +// / \ +// TaskEvent ContainerEvent +// / \ / \ +// RUNNING STOPPED RUNNING STOPPED +// / \ / \ | | +// ARN1 ARN2 ARN3 ARN4 ARN:Cont1 ARN:Cont2 type EventSet map[statechange.EventType]statusToName // Type definition for mapping a Status to a TaskARN/ContainerName diff --git a/agent/engine/docker_image_manager.go b/agent/engine/docker_image_manager.go index 77b8ae94903..6c2539b6c51 100644 --- a/agent/engine/docker_image_manager.go +++ b/agent/engine/docker_image_manager.go @@ -300,7 +300,7 @@ func (imageManager *dockerImageManager) isImageOldEnough(imageState *image.Image return ageOfImage > imageManager.minimumAgeBeforeDeletion } -//TODO: change image createdTime to image lastUsedTime when docker support it in the future +// TODO: change image createdTime to image lastUsedTime when docker support it in the future func (imageManager *dockerImageManager) nonECSImageOldEnough(NonECSImage ImageWithSizeID) bool { ageOfImage := time.Since(NonECSImage.createdTime) return ageOfImage > imageManager.nonECSMinimumAgeBeforeDeletion diff --git a/agent/engine/docker_image_manager_integ_test.go b/agent/engine/docker_image_manager_integ_test.go index bea1debe9b3..031a7bd1415 100644 --- a/agent/engine/docker_image_manager_integ_test.go +++ b/agent/engine/docker_image_manager_integ_test.go @@ -47,15 +47,16 @@ const ( ) // Deletion of images in the order of LRU time: Happy path -// a. This includes starting up agent, pull images, start containers, -// account them in image manager,  stop containers, remove containers, account this in image manager, -// b. Simulate the pulled time (so that it passes the minimum age criteria -// for getting chosen for deletion ) -// c. Start image cleanup , ensure that ONLY the top 2 eligible LRU images -// are removed from the instance,  and those deleted images’ image states are removed from image manager. -// d. Ensure images that do not pass the ‘minimumAgeForDeletion’ criteria are not removed. -// e. Image has not passed the ‘hasNoAssociatedContainers’ criteria. -// f. Ensure that that if not eligible, image is not deleted from the instance and image reference in ImageManager is not removed. +// +// a. This includes starting up agent, pull images, start containers, +// account them in image manager,  stop containers, remove containers, account this in image manager, +// b. Simulate the pulled time (so that it passes the minimum age criteria +// for getting chosen for deletion ) +// c. Start image cleanup , ensure that ONLY the top 2 eligible LRU images +// are removed from the instance,  and those deleted images’ image states are removed from image manager. +// d. Ensure images that do not pass the ‘minimumAgeForDeletion’ criteria are not removed. +// e. Image has not passed the ‘hasNoAssociatedContainers’ criteria. +// f. Ensure that that if not eligible, image is not deleted from the instance and image reference in ImageManager is not removed. func TestIntegImageCleanupHappyCase(t *testing.T) { if runtime.GOOS == "windows" { t.Skip(`Skipping this test because of error: level=error time=2020-05-27T20:20:03Z msg="Error removing` + @@ -164,9 +165,10 @@ func TestIntegImageCleanupHappyCase(t *testing.T) { } // Test that images not falling in the image deletion eligibility criteria are not removed: -// a. Ensure images that do not pass the ‘minimumAgeForDeletion’ criteria are not removed. -// b. Image has not passed the ‘hasNoAssociatedContainers’ criteria. -// c. Ensure that the image is not deleted from the instance and image reference in ImageManager is not removed. +// +// a. Ensure images that do not pass the ‘minimumAgeForDeletion’ criteria are not removed. +// b. Image has not passed the ‘hasNoAssociatedContainers’ criteria. +// c. Ensure that the image is not deleted from the instance and image reference in ImageManager is not removed. func TestIntegImageCleanupThreshold(t *testing.T) { cfg := defaultTestConfigIntegTest() cfg.TaskCleanupWaitDuration = 1 * time.Second diff --git a/agent/engine/docker_task_engine.go b/agent/engine/docker_task_engine.go index 9db91c62e08..369ac3bcf77 100644 --- a/agent/engine/docker_task_engine.go +++ b/agent/engine/docker_task_engine.go @@ -1709,7 +1709,7 @@ func (engine *DockerTaskEngine) provisionContainerResources(task *apitask.Task, } // checkTearDownPauseContainer idempotently tears down the pause container network when the pause container's known -//or desired status is stopped. +// or desired status is stopped. func (engine *DockerTaskEngine) checkTearDownPauseContainer(task *apitask.Task) { if !task.IsNetworkModeAWSVPC() { return diff --git a/agent/engine/docker_task_engine_test.go b/agent/engine/docker_task_engine_test.go index 023aea86f5b..ff3cd3ea3b6 100644 --- a/agent/engine/docker_task_engine_test.go +++ b/agent/engine/docker_task_engine_test.go @@ -1446,12 +1446,13 @@ func TestUpdateContainerReference(t *testing.T) { // TestPullAndUpdateContainerReference checks whether a container is added to task engine state when // Test # | Image availability | DependentContainersPullUpfront | ImagePullBehavior // ----------------------------------------------------------------------------------- -// 1 | remote | enabled | default -// 2 | remote | disabled | default -// 3 | local | enabled | default -// 4 | local | enabled | once -// 5 | local | enabled | prefer-cached -// 6 | local | enabled | always +// +// 1 | remote | enabled | default +// 2 | remote | disabled | default +// 3 | local | enabled | default +// 4 | local | enabled | once +// 5 | local | enabled | prefer-cached +// 6 | local | enabled | always func TestPullAndUpdateContainerReference(t *testing.T) { testcases := []struct { Name string diff --git a/agent/engine/task_manager.go b/agent/engine/task_manager.go index 9a4f32581a3..fe1b00605f3 100644 --- a/agent/engine/task_manager.go +++ b/agent/engine/task_manager.go @@ -115,10 +115,11 @@ type resourceTransition struct { // block and it is expected that the managedTask listen to those channels // almost constantly. // The general operation should be: -// 1) Listen to the channels -// 2) On an event, update the status of the task and containers (known/desired) -// 3) Figure out if any action needs to be done. If so, do it -// 4) GOTO 1 +// 1. Listen to the channels +// 2. On an event, update the status of the task and containers (known/desired) +// 3. Figure out if any action needs to be done. If so, do it +// 4. GOTO 1 +// // Item '3' obviously might lead to some duration where you are not listening // to the channels. However, this can be solved by kicking off '3' as a // goroutine and then only communicating the result back via the channels diff --git a/agent/engine/task_manager_unix_test.go b/agent/engine/task_manager_unix_test.go index a3510571879..06903ef3d96 100644 --- a/agent/engine/task_manager_unix_test.go +++ b/agent/engine/task_manager_unix_test.go @@ -287,7 +287,7 @@ func TestStartResourceTransitionsEmpty(t *testing.T) { } } -//TestEFSNextStateWithTransitionDependencies verifies the dependencies are resolved correctly for task resource +// TestEFSNextStateWithTransitionDependencies verifies the dependencies are resolved correctly for task resource func TestEFSVolumeNextStateWithTransitionDependencies(t *testing.T) { testCases := []struct { name string diff --git a/agent/metrics/generic_metrics_client.go b/agent/metrics/generic_metrics_client.go index 7aab5a633b8..d206f34b08c 100644 --- a/agent/metrics/generic_metrics_client.go +++ b/agent/metrics/generic_metrics_client.go @@ -31,10 +31,11 @@ const ( ) // A GenericMetricsClient records 3 metrics: -// 1) A Prometheus summary vector representing call durations for different API calls -// 2) A durations guage vector that updates the last recorded duration for the API call -// allowing for a time series view in the Prometheus browser -// 3) A counter vector that increments call counts for each API call +// 1. A Prometheus summary vector representing call durations for different API calls +// 2. A durations guage vector that updates the last recorded duration for the API call +// allowing for a time series view in the Prometheus browser +// 3. A counter vector that increments call counts for each API call +// // The outstandingCalls map allows Fired CallStarts to be matched with Fired CallEnds type GenericMetrics struct { durationVec *prometheus.SummaryVec diff --git a/agent/metrics/metrics_test.go b/agent/metrics/metrics_test.go index e9271853db8..f70eb8cb1ce 100644 --- a/agent/metrics/metrics_test.go +++ b/agent/metrics/metrics_test.go @@ -162,7 +162,7 @@ func TestMetricCollection(t *testing.T) { // A type for storing a Tree-based map. We map the MetricName to a map of metrics // under that name. This second map indexes by MetricLabelName+MetricLabelValue to // a slice MetricType and MetricValue. -//MetricName:metricLabelName+metricLabelValue:[metricType, metricValue] +// MetricName:metricLabelName+metricLabelValue:[metricType, metricValue] type metricMap map[string]map[string][]interface{} // In order to verify the MetricFamily with the expected metric values, we do a simple diff --git a/agent/sighandlers/termination_handler.go b/agent/sighandlers/termination_handler.go index 9e6a7517665..f1e0cb599af 100644 --- a/agent/sighandlers/termination_handler.go +++ b/agent/sighandlers/termination_handler.go @@ -13,9 +13,12 @@ // Package sighandlers handle signals and behave appropriately. // SIGTERM: -// Flush state to disk and exit +// +// Flush state to disk and exit +// // SIGUSR1: -// Print a dump of goroutines to the logger and DON'T exit +// +// Print a dump of goroutines to the logger and DON'T exit package sighandlers import ( diff --git a/agent/ssm/factory/factory.go b/agent/ssm/factory/factory.go index 0e68cf1b3c1..02dd453c590 100644 --- a/agent/ssm/factory/factory.go +++ b/agent/ssm/factory/factory.go @@ -39,7 +39,7 @@ func NewSSMClientCreator() SSMClientCreator { type ssmClientCreator struct{} -//SSM Client will automatically retry 3 times when has throttling error +// SSM Client will automatically retry 3 times when has throttling error func (*ssmClientCreator) NewSSMClient(region string, creds credentials.IAMRoleCredentials) ssmclient.SSMClient { cfg := aws.NewConfig(). diff --git a/agent/taskresource/firelens/firelens_unix.go b/agent/taskresource/firelens/firelens_unix.go index 7c53139fdf8..062001f377c 100644 --- a/agent/taskresource/firelens/firelens_unix.go +++ b/agent/taskresource/firelens/firelens_unix.go @@ -432,11 +432,12 @@ func (firelens *FirelensResource) Create() error { var mkdirAll = os.MkdirAll // createDirectories creates two directories: -// - $(DATA_DIR)/firelens/$(TASK_ID)/config: used to store firelens config file. The config file under this directory -// will be mounted to the firelens container at an expected path. -// - $(DATA_DIR)/firelens/$(TASK_ID)/socket: used to store the unix socket. This directory will be mounted to -// the firelens container and it will generate a socket file under this directory. Containers that use firelens to -// send logs will then use this socket to send logs to the firelens container. +// - $(DATA_DIR)/firelens/$(TASK_ID)/config: used to store firelens config file. The config file under this directory +// will be mounted to the firelens container at an expected path. +// - $(DATA_DIR)/firelens/$(TASK_ID)/socket: used to store the unix socket. This directory will be mounted to +// the firelens container and it will generate a socket file under this directory. Containers that use firelens to +// send logs will then use this socket to send logs to the firelens container. +// // Note: socket path has a limit of at most 108 characters on Linux. If using default data dir, the // resulting socket path will be 79 characters (/var/lib/ecs/data/firelens//socket/fluent.sock) which is fine. // However if ECS_HOST_DATA_DIR is specified to be a longer path, we will exceed the limit and fail. I don't really diff --git a/agent/taskresource/firelens/firelensconfig_unix.go b/agent/taskresource/firelens/firelensconfig_unix.go index dbc1709d98c..30bd5c03214 100644 --- a/agent/taskresource/firelens/firelensconfig_unix.go +++ b/agent/taskresource/firelens/firelensconfig_unix.go @@ -224,12 +224,12 @@ func (firelens *FirelensResource) addHealthcheckSections(config generator.Fluent // addOutputSection adds an output section to the firelens container's config that specifies how it routes another // container's logs. It's constructed based on that container's log options. // logOptions is a set of key-value pairs, which includes the following: -// 1. The name of the output plugin (required when there are output options specified, i.e. the ones in 4). For +// 1. The name of the output plugin (required when there are output options specified, i.e. the ones in 4). For // fluentd, the key is "@type", for fluentbit, the key is "Name". -// 2. include-pattern (optional): a regex specifying the logs to be included. -// 3. exclude-pattern (optional): a regex specifying the logs to be excluded. -// 4. All other key-value pairs are customer specified options for the plugin. They are unique for each plugin and -// we don't check them. +// 2. include-pattern (optional): a regex specifying the logs to be included. +// 3. exclude-pattern (optional): a regex specifying the logs to be excluded. +// 4. All other key-value pairs are customer specified options for the plugin. They are unique for each plugin and +// we don't check them. func addOutputSection(tag, firelensConfigType string, logOptions map[string]string, config generator.FluentConfig) (generator.FluentConfig, error) { var outputKey string if firelensConfigType == FirelensConfigTypeFluentd { diff --git a/agent/version/formatting.go b/agent/version/formatting.go index 76532ca205d..4c5689313cb 100644 --- a/agent/version/formatting.go +++ b/agent/version/formatting.go @@ -22,9 +22,9 @@ import ( // PrintVersions prints the version information on stdout as a multi-line // string. The output will look similar to the following: // -// Amazon ECS Agent: -// Version: 0.0.3 -// Commit: 4bdc7fc +// Amazon ECS Agent: +// Version: 0.0.3 +// Commit: 4bdc7fc func PrintVersion() int { cleanliness := "" if GitDirty { diff --git a/agent/wsclient/client.go b/agent/wsclient/client.go index fbc6c450394..04476054451 100644 --- a/agent/wsclient/client.go +++ b/agent/wsclient/client.go @@ -312,7 +312,9 @@ func (cs *ClientServerImpl) Disconnect(...interface{}) error { // argument *must* be a pointer to a recognized 'ecsacs' struct. // E.g. if you desired to handle messages from acs of type 'FooMessage', you // would pass the following handler in: -// func(message *ecsacs.FooMessage) +// +// func(message *ecsacs.FooMessage) +// // This function will panic if the passed in function does not have one pointer // argument or the argument is not a recognized type. // Additionally, the request handler will block processing of further messages From fbd071d3f2299c06f923f6085a33edd9a505aa33 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Thu, 22 Sep 2022 14:32:58 -0700 Subject: [PATCH 3/5] make goimports -f init_Makefile --- ecs-init/cache/cache_test.go | 2 ++ ecs-init/cache/dependencies.go | 2 +- ecs-init/config/logger.go | 2 +- ecs-init/docker/dependencies_test.go | 2 ++ ecs-init/docker/docker.go | 6 +++--- ecs-init/docker/docker_test.go | 2 ++ ecs-init/engine/engine_test.go | 2 ++ init_Makefile | 4 ++++ 8 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ecs-init/cache/cache_test.go b/ecs-init/cache/cache_test.go index 52e8446b905..04071c699e2 100644 --- a/ecs-init/cache/cache_test.go +++ b/ecs-init/cache/cache_test.go @@ -1,4 +1,6 @@ +//go:build test // +build test + // Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). You may diff --git a/ecs-init/cache/dependencies.go b/ecs-init/cache/dependencies.go index 161964a25a7..a2d0138c72d 100644 --- a/ecs-init/cache/dependencies.go +++ b/ecs-init/cache/dependencies.go @@ -18,7 +18,7 @@ package cache // package-level functions. These interfaces are then used to create mocks // for the unit tests. -//go:generate mockgen.sh cache $GOFILE +//go:generate mockgen.sh cache $GOFILE import ( "io" diff --git a/ecs-init/config/logger.go b/ecs-init/config/logger.go index 9e1093dc894..20699f3c885 100644 --- a/ecs-init/config/logger.go +++ b/ecs-init/config/logger.go @@ -34,7 +34,7 @@ and limitations under the License. - diff --git a/ecs-init/docker/dependencies_test.go b/ecs-init/docker/dependencies_test.go index 01220bc92a6..66a630b77c8 100644 --- a/ecs-init/docker/dependencies_test.go +++ b/ecs-init/docker/dependencies_test.go @@ -1,4 +1,6 @@ +//go:build test // +build test + // Copyright 2015-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). You may diff --git a/ecs-init/docker/docker.go b/ecs-init/docker/docker.go index 23f0a423c58..0748c75b5d6 100644 --- a/ecs-init/docker/docker.go +++ b/ecs-init/docker/docker.go @@ -439,9 +439,9 @@ func (c *client) getHostConfig(envVarsFromFiles map[string]string) *godocker.Hos // getDockerSocketBind returns the bind for Docker socket. // Value for the bind is as follow: -// 1. DOCKER_HOST (as in os.Getenv) not set: source /var/run, dest /var/run -// 2. DOCKER_HOST (as in os.Getenv) set: source DOCKER_HOST (as in os.Getenv, trim unix:// prefix), -// dest DOCKER_HOST (as in /etc/ecs/ecs.config, trim unix:// prefix) +// 1. DOCKER_HOST (as in os.Getenv) not set: source /var/run, dest /var/run +// 2. DOCKER_HOST (as in os.Getenv) set: source DOCKER_HOST (as in os.Getenv, trim unix:// prefix), +// dest DOCKER_HOST (as in /etc/ecs/ecs.config, trim unix:// prefix) // // On AL2, the value from os.Getenv is the same as the one from /etc/ecs/ecs.config, but on AL1 they might be different, which // is why I distinguish the two. diff --git a/ecs-init/docker/docker_test.go b/ecs-init/docker/docker_test.go index 2059acbd65b..284f88d4cf7 100644 --- a/ecs-init/docker/docker_test.go +++ b/ecs-init/docker/docker_test.go @@ -1,4 +1,6 @@ +//go:build test // +build test + // Copyright 2015-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). You may diff --git a/ecs-init/engine/engine_test.go b/ecs-init/engine/engine_test.go index 2b706fd487e..4c6154382f6 100644 --- a/ecs-init/engine/engine_test.go +++ b/ecs-init/engine/engine_test.go @@ -1,4 +1,6 @@ +//go:build test // +build test + // Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). You may diff --git a/init_Makefile b/init_Makefile index 66aa6f369a0..88265bae223 100644 --- a/init_Makefile +++ b/init_Makefile @@ -45,6 +45,10 @@ gocyclo: GOFMTFILES:=$(shell find ./ecs-init -not -path './ecs-init/vendor/*' -type f -iregex '.*\.go') +.PHONY: goimports +goimports: + goimports -w $(GOFMTFILES) + .PHONY: importcheck importcheck: $(eval DIFFS:=$(shell goimports -l $(GOFMTFILES))) From 3be450f34ac7b56d219f2ad822f7f7be45e1f948 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Thu, 22 Sep 2022 14:50:17 -0700 Subject: [PATCH 4/5] fix seelog xml --- seelog.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seelog.xml b/seelog.xml index 3446a8b2b16..e1fae8591ad 100644 --- a/seelog.xml +++ b/seelog.xml @@ -13,11 +13,11 @@ and limitations under the License. - - \ No newline at end of file + From c06033173efe6857864b3bdc501ac4f219301ca6 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Thu, 22 Sep 2022 14:58:44 -0700 Subject: [PATCH 5/5] deprecate ioutil --- ecs-init/cache/cache_test.go | 33 +++++++++++++++--------------- ecs-init/cache/dependencies.go | 9 ++++---- ecs-init/docker/dependencies.go | 4 ++-- ecs-init/docker/docker_test.go | 5 ++--- ecs-init/engine/engine_test.go | 12 +++++------ ecs-init/gpu/nvidia_gpu_manager.go | 3 +-- ecs-init/volumes/state_manager.go | 5 ++--- 7 files changed, 33 insertions(+), 38 deletions(-) diff --git a/ecs-init/cache/cache_test.go b/ecs-init/cache/cache_test.go index 04071c699e2..2789ccaee70 100644 --- a/ecs-init/cache/cache_test.go +++ b/ecs-init/cache/cache_test.go @@ -22,7 +22,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "log" "os" "testing" @@ -102,7 +101,7 @@ func TestIsAgentCachedTrue(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - file := ioutil.NopCloser(bytes.NewBufferString(fmt.Sprintf("%d", StatusCached))) + file := io.NopCloser(bytes.NewBufferString(fmt.Sprintf("%d", StatusCached))) mockFS := NewMockfileSystem(mockCtrl) mockFSInfo := NewMockfileSizeInfo(mockCtrl) mockFS.EXPECT().Stat(config.CacheState()).Return(mockFSInfo, nil) @@ -138,7 +137,7 @@ func TestAgentCacheStatus(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - file := ioutil.NopCloser(bytes.NewBufferString(testcase.data)) + file := io.NopCloser(bytes.NewBufferString(testcase.data)) mockFS := NewMockfileSystem(mockCtrl) mockFSInfo := NewMockfileSizeInfo(mockCtrl) @@ -227,7 +226,7 @@ func TestDownloadAgentReadPublishedMd5Failure(t *testing.T) { mockS3Downloader := NewMocks3DownloaderAPI(mockCtrl) mockMetadata := NewMockinstanceMetadata(mockCtrl) - tempMD5File, err := ioutil.TempFile("", "md5-test") + tempMD5File, err := os.CreateTemp("", "md5-test") assert.NoError(t, err, "Expect to successfully create a temporary file") defer tempMD5File.Close() @@ -259,11 +258,11 @@ func TestDownloadAgentDownloadTarballFailure(t *testing.T) { mockS3Downloader := NewMocks3DownloaderAPI(mockCtrl) mockMetadata := NewMockinstanceMetadata(mockCtrl) - tempMD5File, err := ioutil.TempFile("", "md5-test") + tempMD5File, err := os.CreateTemp("", "md5-test") assert.NoError(t, err, "Expect to successfully create a temporary file") defer tempMD5File.Close() - tempAgentFile, err := ioutil.TempFile("", "agent-test") + tempAgentFile, err := os.CreateTemp("", "agent-test") assert.NoError(t, err, "Expect to successfully create a temporary file") defer tempAgentFile.Close() @@ -296,15 +295,15 @@ func TestDownloadAgentCopyFailure(t *testing.T) { mockS3Downloader := NewMocks3DownloaderAPI(mockCtrl) mockMetadata := NewMockinstanceMetadata(mockCtrl) - tempMD5File, err := ioutil.TempFile("", "md5-test") + tempMD5File, err := os.CreateTemp("", "md5-test") assert.NoError(t, err, "Expect to successfully create a temporary file") defer tempMD5File.Close() - tempAgentFile, err := ioutil.TempFile("", "agent-test") + tempAgentFile, err := os.CreateTemp("", "agent-test") assert.NoError(t, err, "Expect to successfully create a temporary file") defer tempAgentFile.Close() - tempReader := ioutil.NopCloser(&bytes.Buffer{}) + tempReader := io.NopCloser(&bytes.Buffer{}) gomock.InOrder( mockFS.EXPECT().MkdirAll(config.CacheDirectory(), os.ModeDir|0700), @@ -339,15 +338,15 @@ func TestDownloadAgentMD5Mismatch(t *testing.T) { mockS3Downloader := NewMocks3DownloaderAPI(mockCtrl) mockMetadata := NewMockinstanceMetadata(mockCtrl) - tempMD5File, err := ioutil.TempFile("", "md5-test") + tempMD5File, err := os.CreateTemp("", "md5-test") assert.NoError(t, err, "Expect to successfully create a temporary file") defer tempMD5File.Close() - tempAgentFile, err := ioutil.TempFile("", "agent-test") + tempAgentFile, err := os.CreateTemp("", "agent-test") assert.NoError(t, err, "Expect to successfully create a temporary file") defer tempAgentFile.Close() - tempReader := ioutil.NopCloser(&bytes.Buffer{}) + tempReader := io.NopCloser(&bytes.Buffer{}) gomock.InOrder( mockFS.EXPECT().MkdirAll(config.CacheDirectory(), os.ModeDir|0700), @@ -377,14 +376,14 @@ func TestDownloadAgentSuccess(t *testing.T) { defer mockCtrl.Finish() tarballContents := "tarball contents" - tarballReader := ioutil.NopCloser(bytes.NewBufferString(tarballContents)) + tarballReader := io.NopCloser(bytes.NewBufferString(tarballContents)) expectedMd5Sum := fmt.Sprintf("%x\n", md5.Sum([]byte(tarballContents))) - tempMD5File, err := ioutil.TempFile("", "md5-test") + tempMD5File, err := os.CreateTemp("", "md5-test") assert.NoError(t, err, "Expect to successfully create a temporary file") defer tempMD5File.Close() - tempAgentFile, err := ioutil.TempFile("", "agent-test") + tempAgentFile, err := os.CreateTemp("", "agent-test") assert.NoError(t, err, "Expect to successfully create a temporary file") defer tempAgentFile.Close() @@ -440,7 +439,7 @@ func TestLoadDesiredAgentFailReadDesired(t *testing.T) { mockFS := NewMockfileSystem(mockCtrl) - mockFS.EXPECT().Open(config.DesiredImageLocatorFile()).Return(ioutil.NopCloser(&bytes.Buffer{}), nil) + mockFS.EXPECT().Open(config.DesiredImageLocatorFile()).Return(io.NopCloser(&bytes.Buffer{}), nil) d := &Downloader{ fs: mockFS, @@ -472,7 +471,7 @@ func TestLoadDesiredAgent(t *testing.T) { mockFS := NewMockfileSystem(mockCtrl) - mockFS.EXPECT().Open(config.DesiredImageLocatorFile()).Return(ioutil.NopCloser(bytes.NewBufferString(desiredImage+"\n")), nil) + mockFS.EXPECT().Open(config.DesiredImageLocatorFile()).Return(io.NopCloser(bytes.NewBufferString(desiredImage+"\n")), nil) mockFS.EXPECT().Base(gomock.Any()).Return(desiredImage + "\n") mockFS.EXPECT().Open(config.CacheDirectory() + "/" + desiredImage) diff --git a/ecs-init/cache/dependencies.go b/ecs-init/cache/dependencies.go index a2d0138c72d..0db2f1116e0 100644 --- a/ecs-init/cache/dependencies.go +++ b/ecs-init/cache/dependencies.go @@ -22,7 +22,6 @@ package cache import ( "io" - "io/ioutil" "os" "path/filepath" @@ -118,7 +117,7 @@ func (d *s3Downloader) downloadFile(fileName string) (string, error) { return "", errors.New("failed to download file from s3") } -// fileSystem captures related functions from os, io, and io/ioutil packages +// fileSystem captures related functions from io and os packages type fileSystem interface { MkdirAll(path string, perm os.FileMode) error TempFile(dir, prefix string) (f *os.File, err error) @@ -156,7 +155,7 @@ func (s *standardFS) MkdirAll(path string, perm os.FileMode) error { } func (s *standardFS) TempFile(dir, prefix string) (*os.File, error) { - return ioutil.TempFile(dir, prefix) + return os.CreateTemp(dir, prefix) } func (s *standardFS) Remove(path string) { @@ -176,7 +175,7 @@ func (s *standardFS) Rename(oldpath, newpath string) error { } func (s *standardFS) ReadAll(r io.Reader) ([]byte, error) { - return ioutil.ReadAll(r) + return io.ReadAll(r) } func (s *standardFS) Open(name string) (io.ReadCloser, error) { @@ -192,5 +191,5 @@ func (s *standardFS) Base(path string) string { } func (s *standardFS) WriteFile(filename string, data []byte, perm os.FileMode) error { - return ioutil.WriteFile(filename, data, perm) + return os.WriteFile(filename, data, perm) } diff --git a/ecs-init/docker/dependencies.go b/ecs-init/docker/dependencies.go index f7b159c8170..53dc2584361 100644 --- a/ecs-init/docker/dependencies.go +++ b/ecs-init/docker/dependencies.go @@ -16,10 +16,10 @@ package docker //go:generate mockgen.sh $GOPACKAGE $GOFILE import ( - "io/ioutil" "net" "net/http" "net/url" + "os" "time" "github.com/aws/amazon-ecs-agent/ecs-init/backoff" @@ -142,7 +142,7 @@ type _standardFS struct{} var standardFS = &_standardFS{} func (s *_standardFS) ReadFile(filename string) ([]byte, error) { - return ioutil.ReadFile(filename) + return os.ReadFile(filename) } func isNetworkError(err error) bool { diff --git a/ecs-init/docker/docker_test.go b/ecs-init/docker/docker_test.go index 284f88d4cf7..e1d9415065e 100644 --- a/ecs-init/docker/docker_test.go +++ b/ecs-init/docker/docker_test.go @@ -18,7 +18,6 @@ package docker import ( "errors" - "io/ioutil" "os" "path/filepath" "testing" @@ -945,13 +944,13 @@ func TestGetCapabilityExecBinds(t *testing.T) { } func TestDefaultIsPathValid(t *testing.T) { - rootDir, err := ioutil.TempDir(os.TempDir(), testTempDirPrefix) + rootDir, err := os.MkdirTemp(os.TempDir(), testTempDirPrefix) if err != nil { t.Fatal(err) } defer os.RemoveAll(rootDir) - file, err := ioutil.TempFile(rootDir, "file") + file, err := os.CreateTemp(rootDir, "file") if err != nil { t.Fatal(err) } diff --git a/ecs-init/engine/engine_test.go b/ecs-init/engine/engine_test.go index 4c6154382f6..029c48aa9ba 100644 --- a/ecs-init/engine/engine_test.go +++ b/ecs-init/engine/engine_test.go @@ -20,7 +20,7 @@ import ( "bytes" "errors" "fmt" - "io/ioutil" + "io" "os" "testing" @@ -79,7 +79,7 @@ func TestPreStartReloadNeeded(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - cachedAgentBuffer := ioutil.NopCloser(&bytes.Buffer{}) + cachedAgentBuffer := io.NopCloser(&bytes.Buffer{}) mockDocker := NewMockdockerClient(mockCtrl) defer getDockerClientMock(mockDocker)() @@ -117,7 +117,7 @@ func TestPreStartImageNotLoadedCached(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - cachedAgentBuffer := ioutil.NopCloser(&bytes.Buffer{}) + cachedAgentBuffer := io.NopCloser(&bytes.Buffer{}) mockDocker := NewMockdockerClient(mockCtrl) mockDownloader := NewMockdownloader(mockCtrl) @@ -152,7 +152,7 @@ func TestPreStartImageNotCached(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - cachedAgentBuffer := ioutil.NopCloser(&bytes.Buffer{}) + cachedAgentBuffer := io.NopCloser(&bytes.Buffer{}) mockDocker := NewMockdockerClient(mockCtrl) defer getDockerClientMock(mockDocker)() @@ -431,7 +431,7 @@ func TestReloadCacheNotCached(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - cachedAgentBuffer := ioutil.NopCloser(&bytes.Buffer{}) + cachedAgentBuffer := io.NopCloser(&bytes.Buffer{}) mockDocker := NewMockdockerClient(mockCtrl) defer getDockerClientMock(mockDocker)() @@ -456,7 +456,7 @@ func TestReloadCacheCached(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - cachedAgentBuffer := ioutil.NopCloser(&bytes.Buffer{}) + cachedAgentBuffer := io.NopCloser(&bytes.Buffer{}) mockDocker := NewMockdockerClient(mockCtrl) defer getDockerClientMock(mockDocker)() diff --git a/ecs-init/gpu/nvidia_gpu_manager.go b/ecs-init/gpu/nvidia_gpu_manager.go index 97ed2ef03b6..8a426d9e4ff 100644 --- a/ecs-init/gpu/nvidia_gpu_manager.go +++ b/ecs-init/gpu/nvidia_gpu_manager.go @@ -15,7 +15,6 @@ package gpu import ( "encoding/json" - "io/ioutil" "os" "path/filepath" @@ -219,5 +218,5 @@ func WriteToFile(filename string, data []byte, perm os.FileMode) error { if err != nil { return err } - return ioutil.WriteFile(filename, data, perm) + return os.WriteFile(filename, data, perm) } diff --git a/ecs-init/volumes/state_manager.go b/ecs-init/volumes/state_manager.go index d367679e85d..35ed35fe04e 100644 --- a/ecs-init/volumes/state_manager.go +++ b/ecs-init/volumes/state_manager.go @@ -16,7 +16,6 @@ package volumes import ( "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "sync" @@ -94,7 +93,7 @@ var saveStateToDisk = saveState func saveState(b []byte) error { // Make our temp-file on the same volume as our data-file to ensure we can // actually move it atomically; cross-device renaming will error out - tmpfile, err := ioutil.TempFile(PluginStatePath, "tmp_ecs_volume_plugin") + tmpfile, err := os.CreateTemp(PluginStatePath, "tmp_ecs_volume_plugin") if err != nil { return fmt.Errorf("failed to create temp file: %v", err) } @@ -154,5 +153,5 @@ func (s *StateManager) load(a interface{}) error { var readStateFile = readFile func readFile() ([]byte, error) { - return ioutil.ReadFile(PluginStateFileAbsPath) + return os.ReadFile(PluginStateFileAbsPath) }