mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-30 04:20:53 +00:00
Update Go AWS SDK to the latest version
This commit is contained in:
committed by
Andrey Smirnov
parent
d08be990ef
commit
94a72b23ff
+5670
-581
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -10,7 +10,7 @@
|
||||
// tasks using the Fargate launch type. For more control, you can host your
|
||||
// tasks on a cluster of Amazon Elastic Compute Cloud (Amazon EC2) instances
|
||||
// that you manage by using the EC2 launch type. For more information about
|
||||
// launch types, see Amazon ECS Launch Types (http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html).
|
||||
// launch types, see Amazon ECS Launch Types (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html).
|
||||
//
|
||||
// Amazon ECS lets you launch and stop container-based applications with simple
|
||||
// API calls, allows you to get the state of your cluster from a centralized
|
||||
|
||||
+52
@@ -68,6 +68,14 @@ type ECSAPI interface {
|
||||
CreateServiceWithContext(aws.Context, *ecs.CreateServiceInput, ...request.Option) (*ecs.CreateServiceOutput, error)
|
||||
CreateServiceRequest(*ecs.CreateServiceInput) (*request.Request, *ecs.CreateServiceOutput)
|
||||
|
||||
CreateTaskSet(*ecs.CreateTaskSetInput) (*ecs.CreateTaskSetOutput, error)
|
||||
CreateTaskSetWithContext(aws.Context, *ecs.CreateTaskSetInput, ...request.Option) (*ecs.CreateTaskSetOutput, error)
|
||||
CreateTaskSetRequest(*ecs.CreateTaskSetInput) (*request.Request, *ecs.CreateTaskSetOutput)
|
||||
|
||||
DeleteAccountSetting(*ecs.DeleteAccountSettingInput) (*ecs.DeleteAccountSettingOutput, error)
|
||||
DeleteAccountSettingWithContext(aws.Context, *ecs.DeleteAccountSettingInput, ...request.Option) (*ecs.DeleteAccountSettingOutput, error)
|
||||
DeleteAccountSettingRequest(*ecs.DeleteAccountSettingInput) (*request.Request, *ecs.DeleteAccountSettingOutput)
|
||||
|
||||
DeleteAttributes(*ecs.DeleteAttributesInput) (*ecs.DeleteAttributesOutput, error)
|
||||
DeleteAttributesWithContext(aws.Context, *ecs.DeleteAttributesInput, ...request.Option) (*ecs.DeleteAttributesOutput, error)
|
||||
DeleteAttributesRequest(*ecs.DeleteAttributesInput) (*request.Request, *ecs.DeleteAttributesOutput)
|
||||
@@ -80,6 +88,10 @@ type ECSAPI interface {
|
||||
DeleteServiceWithContext(aws.Context, *ecs.DeleteServiceInput, ...request.Option) (*ecs.DeleteServiceOutput, error)
|
||||
DeleteServiceRequest(*ecs.DeleteServiceInput) (*request.Request, *ecs.DeleteServiceOutput)
|
||||
|
||||
DeleteTaskSet(*ecs.DeleteTaskSetInput) (*ecs.DeleteTaskSetOutput, error)
|
||||
DeleteTaskSetWithContext(aws.Context, *ecs.DeleteTaskSetInput, ...request.Option) (*ecs.DeleteTaskSetOutput, error)
|
||||
DeleteTaskSetRequest(*ecs.DeleteTaskSetInput) (*request.Request, *ecs.DeleteTaskSetOutput)
|
||||
|
||||
DeregisterContainerInstance(*ecs.DeregisterContainerInstanceInput) (*ecs.DeregisterContainerInstanceOutput, error)
|
||||
DeregisterContainerInstanceWithContext(aws.Context, *ecs.DeregisterContainerInstanceInput, ...request.Option) (*ecs.DeregisterContainerInstanceOutput, error)
|
||||
DeregisterContainerInstanceRequest(*ecs.DeregisterContainerInstanceInput) (*request.Request, *ecs.DeregisterContainerInstanceOutput)
|
||||
@@ -104,6 +116,10 @@ type ECSAPI interface {
|
||||
DescribeTaskDefinitionWithContext(aws.Context, *ecs.DescribeTaskDefinitionInput, ...request.Option) (*ecs.DescribeTaskDefinitionOutput, error)
|
||||
DescribeTaskDefinitionRequest(*ecs.DescribeTaskDefinitionInput) (*request.Request, *ecs.DescribeTaskDefinitionOutput)
|
||||
|
||||
DescribeTaskSets(*ecs.DescribeTaskSetsInput) (*ecs.DescribeTaskSetsOutput, error)
|
||||
DescribeTaskSetsWithContext(aws.Context, *ecs.DescribeTaskSetsInput, ...request.Option) (*ecs.DescribeTaskSetsOutput, error)
|
||||
DescribeTaskSetsRequest(*ecs.DescribeTaskSetsInput) (*request.Request, *ecs.DescribeTaskSetsOutput)
|
||||
|
||||
DescribeTasks(*ecs.DescribeTasksInput) (*ecs.DescribeTasksOutput, error)
|
||||
DescribeTasksWithContext(aws.Context, *ecs.DescribeTasksInput, ...request.Option) (*ecs.DescribeTasksOutput, error)
|
||||
DescribeTasksRequest(*ecs.DescribeTasksInput) (*request.Request, *ecs.DescribeTasksOutput)
|
||||
@@ -112,6 +128,10 @@ type ECSAPI interface {
|
||||
DiscoverPollEndpointWithContext(aws.Context, *ecs.DiscoverPollEndpointInput, ...request.Option) (*ecs.DiscoverPollEndpointOutput, error)
|
||||
DiscoverPollEndpointRequest(*ecs.DiscoverPollEndpointInput) (*request.Request, *ecs.DiscoverPollEndpointOutput)
|
||||
|
||||
ListAccountSettings(*ecs.ListAccountSettingsInput) (*ecs.ListAccountSettingsOutput, error)
|
||||
ListAccountSettingsWithContext(aws.Context, *ecs.ListAccountSettingsInput, ...request.Option) (*ecs.ListAccountSettingsOutput, error)
|
||||
ListAccountSettingsRequest(*ecs.ListAccountSettingsInput) (*request.Request, *ecs.ListAccountSettingsOutput)
|
||||
|
||||
ListAttributes(*ecs.ListAttributesInput) (*ecs.ListAttributesOutput, error)
|
||||
ListAttributesWithContext(aws.Context, *ecs.ListAttributesInput, ...request.Option) (*ecs.ListAttributesOutput, error)
|
||||
ListAttributesRequest(*ecs.ListAttributesInput) (*request.Request, *ecs.ListAttributesOutput)
|
||||
@@ -137,6 +157,10 @@ type ECSAPI interface {
|
||||
ListServicesPages(*ecs.ListServicesInput, func(*ecs.ListServicesOutput, bool) bool) error
|
||||
ListServicesPagesWithContext(aws.Context, *ecs.ListServicesInput, func(*ecs.ListServicesOutput, bool) bool, ...request.Option) error
|
||||
|
||||
ListTagsForResource(*ecs.ListTagsForResourceInput) (*ecs.ListTagsForResourceOutput, error)
|
||||
ListTagsForResourceWithContext(aws.Context, *ecs.ListTagsForResourceInput, ...request.Option) (*ecs.ListTagsForResourceOutput, error)
|
||||
ListTagsForResourceRequest(*ecs.ListTagsForResourceInput) (*request.Request, *ecs.ListTagsForResourceOutput)
|
||||
|
||||
ListTaskDefinitionFamilies(*ecs.ListTaskDefinitionFamiliesInput) (*ecs.ListTaskDefinitionFamiliesOutput, error)
|
||||
ListTaskDefinitionFamiliesWithContext(aws.Context, *ecs.ListTaskDefinitionFamiliesInput, ...request.Option) (*ecs.ListTaskDefinitionFamiliesOutput, error)
|
||||
ListTaskDefinitionFamiliesRequest(*ecs.ListTaskDefinitionFamiliesInput) (*request.Request, *ecs.ListTaskDefinitionFamiliesOutput)
|
||||
@@ -158,6 +182,14 @@ type ECSAPI interface {
|
||||
ListTasksPages(*ecs.ListTasksInput, func(*ecs.ListTasksOutput, bool) bool) error
|
||||
ListTasksPagesWithContext(aws.Context, *ecs.ListTasksInput, func(*ecs.ListTasksOutput, bool) bool, ...request.Option) error
|
||||
|
||||
PutAccountSetting(*ecs.PutAccountSettingInput) (*ecs.PutAccountSettingOutput, error)
|
||||
PutAccountSettingWithContext(aws.Context, *ecs.PutAccountSettingInput, ...request.Option) (*ecs.PutAccountSettingOutput, error)
|
||||
PutAccountSettingRequest(*ecs.PutAccountSettingInput) (*request.Request, *ecs.PutAccountSettingOutput)
|
||||
|
||||
PutAccountSettingDefault(*ecs.PutAccountSettingDefaultInput) (*ecs.PutAccountSettingDefaultOutput, error)
|
||||
PutAccountSettingDefaultWithContext(aws.Context, *ecs.PutAccountSettingDefaultInput, ...request.Option) (*ecs.PutAccountSettingDefaultOutput, error)
|
||||
PutAccountSettingDefaultRequest(*ecs.PutAccountSettingDefaultInput) (*request.Request, *ecs.PutAccountSettingDefaultOutput)
|
||||
|
||||
PutAttributes(*ecs.PutAttributesInput) (*ecs.PutAttributesOutput, error)
|
||||
PutAttributesWithContext(aws.Context, *ecs.PutAttributesInput, ...request.Option) (*ecs.PutAttributesOutput, error)
|
||||
PutAttributesRequest(*ecs.PutAttributesInput) (*request.Request, *ecs.PutAttributesOutput)
|
||||
@@ -182,6 +214,10 @@ type ECSAPI interface {
|
||||
StopTaskWithContext(aws.Context, *ecs.StopTaskInput, ...request.Option) (*ecs.StopTaskOutput, error)
|
||||
StopTaskRequest(*ecs.StopTaskInput) (*request.Request, *ecs.StopTaskOutput)
|
||||
|
||||
SubmitAttachmentStateChanges(*ecs.SubmitAttachmentStateChangesInput) (*ecs.SubmitAttachmentStateChangesOutput, error)
|
||||
SubmitAttachmentStateChangesWithContext(aws.Context, *ecs.SubmitAttachmentStateChangesInput, ...request.Option) (*ecs.SubmitAttachmentStateChangesOutput, error)
|
||||
SubmitAttachmentStateChangesRequest(*ecs.SubmitAttachmentStateChangesInput) (*request.Request, *ecs.SubmitAttachmentStateChangesOutput)
|
||||
|
||||
SubmitContainerStateChange(*ecs.SubmitContainerStateChangeInput) (*ecs.SubmitContainerStateChangeOutput, error)
|
||||
SubmitContainerStateChangeWithContext(aws.Context, *ecs.SubmitContainerStateChangeInput, ...request.Option) (*ecs.SubmitContainerStateChangeOutput, error)
|
||||
SubmitContainerStateChangeRequest(*ecs.SubmitContainerStateChangeInput) (*request.Request, *ecs.SubmitContainerStateChangeOutput)
|
||||
@@ -190,6 +226,14 @@ type ECSAPI interface {
|
||||
SubmitTaskStateChangeWithContext(aws.Context, *ecs.SubmitTaskStateChangeInput, ...request.Option) (*ecs.SubmitTaskStateChangeOutput, error)
|
||||
SubmitTaskStateChangeRequest(*ecs.SubmitTaskStateChangeInput) (*request.Request, *ecs.SubmitTaskStateChangeOutput)
|
||||
|
||||
TagResource(*ecs.TagResourceInput) (*ecs.TagResourceOutput, error)
|
||||
TagResourceWithContext(aws.Context, *ecs.TagResourceInput, ...request.Option) (*ecs.TagResourceOutput, error)
|
||||
TagResourceRequest(*ecs.TagResourceInput) (*request.Request, *ecs.TagResourceOutput)
|
||||
|
||||
UntagResource(*ecs.UntagResourceInput) (*ecs.UntagResourceOutput, error)
|
||||
UntagResourceWithContext(aws.Context, *ecs.UntagResourceInput, ...request.Option) (*ecs.UntagResourceOutput, error)
|
||||
UntagResourceRequest(*ecs.UntagResourceInput) (*request.Request, *ecs.UntagResourceOutput)
|
||||
|
||||
UpdateContainerAgent(*ecs.UpdateContainerAgentInput) (*ecs.UpdateContainerAgentOutput, error)
|
||||
UpdateContainerAgentWithContext(aws.Context, *ecs.UpdateContainerAgentInput, ...request.Option) (*ecs.UpdateContainerAgentOutput, error)
|
||||
UpdateContainerAgentRequest(*ecs.UpdateContainerAgentInput) (*request.Request, *ecs.UpdateContainerAgentOutput)
|
||||
@@ -202,6 +246,14 @@ type ECSAPI interface {
|
||||
UpdateServiceWithContext(aws.Context, *ecs.UpdateServiceInput, ...request.Option) (*ecs.UpdateServiceOutput, error)
|
||||
UpdateServiceRequest(*ecs.UpdateServiceInput) (*request.Request, *ecs.UpdateServiceOutput)
|
||||
|
||||
UpdateServicePrimaryTaskSet(*ecs.UpdateServicePrimaryTaskSetInput) (*ecs.UpdateServicePrimaryTaskSetOutput, error)
|
||||
UpdateServicePrimaryTaskSetWithContext(aws.Context, *ecs.UpdateServicePrimaryTaskSetInput, ...request.Option) (*ecs.UpdateServicePrimaryTaskSetOutput, error)
|
||||
UpdateServicePrimaryTaskSetRequest(*ecs.UpdateServicePrimaryTaskSetInput) (*request.Request, *ecs.UpdateServicePrimaryTaskSetOutput)
|
||||
|
||||
UpdateTaskSet(*ecs.UpdateTaskSetInput) (*ecs.UpdateTaskSetOutput, error)
|
||||
UpdateTaskSetWithContext(aws.Context, *ecs.UpdateTaskSetInput, ...request.Option) (*ecs.UpdateTaskSetOutput, error)
|
||||
UpdateTaskSetRequest(*ecs.UpdateTaskSetInput) (*request.Request, *ecs.UpdateTaskSetOutput)
|
||||
|
||||
WaitUntilServicesInactive(*ecs.DescribeServicesInput) error
|
||||
WaitUntilServicesInactiveWithContext(aws.Context, *ecs.DescribeServicesInput, ...request.WaiterOption) error
|
||||
|
||||
|
||||
+27
-13
@@ -21,8 +21,8 @@ const (
|
||||
// ErrCodeBlockedException for service response error code
|
||||
// "BlockedException".
|
||||
//
|
||||
// Your AWS account has been blocked. Contact AWS Support (http://aws.amazon.com/contact-us/)
|
||||
// for more information.
|
||||
// Your AWS account has been blocked. For more information, contact AWS Support
|
||||
// (http://aws.amazon.com/contact-us/).
|
||||
ErrCodeBlockedException = "BlockedException"
|
||||
|
||||
// ErrCodeClientException for service response error code
|
||||
@@ -36,17 +36,17 @@ const (
|
||||
// ErrCodeClusterContainsContainerInstancesException for service response error code
|
||||
// "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.
|
||||
// You cannot delete a cluster that has registered container instances. First,
|
||||
// deregister the container instances before you can delete the cluster. For
|
||||
// more information, see DeregisterContainerInstance.
|
||||
ErrCodeClusterContainsContainerInstancesException = "ClusterContainsContainerInstancesException"
|
||||
|
||||
// ErrCodeClusterContainsServicesException for service response error code
|
||||
// "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.
|
||||
// You cannot delete a cluster that contains services. First, update the service
|
||||
// to reduce its desired task count to 0 and then delete the service. For more
|
||||
// information, see UpdateService and DeleteService.
|
||||
ErrCodeClusterContainsServicesException = "ClusterContainsServicesException"
|
||||
|
||||
// ErrCodeClusterContainsTasksException for service response error code
|
||||
@@ -59,7 +59,7 @@ const (
|
||||
// "ClusterNotFoundException".
|
||||
//
|
||||
// The specified cluster could not be found. You can view your available clusters
|
||||
// with ListClusters. Amazon ECS clusters are region-specific.
|
||||
// with ListClusters. Amazon ECS clusters are Region-specific.
|
||||
ErrCodeClusterNotFoundException = "ClusterNotFoundException"
|
||||
|
||||
// ErrCodeInvalidParameterException for service response error code
|
||||
@@ -89,7 +89,7 @@ const (
|
||||
// ErrCodePlatformTaskDefinitionIncompatibilityException for service response error code
|
||||
// "PlatformTaskDefinitionIncompatibilityException".
|
||||
//
|
||||
// The specified platform version does not satisfy the task definition’s required
|
||||
// The specified platform version does not satisfy the task definition's required
|
||||
// capabilities.
|
||||
ErrCodePlatformTaskDefinitionIncompatibilityException = "PlatformTaskDefinitionIncompatibilityException"
|
||||
|
||||
@@ -99,6 +99,12 @@ const (
|
||||
// The specified platform version does not exist.
|
||||
ErrCodePlatformUnknownException = "PlatformUnknownException"
|
||||
|
||||
// ErrCodeResourceNotFoundException for service response error code
|
||||
// "ResourceNotFoundException".
|
||||
//
|
||||
// The specified resource could not be found.
|
||||
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
|
||||
|
||||
// ErrCodeServerException for service response error code
|
||||
// "ServerException".
|
||||
//
|
||||
@@ -116,7 +122,7 @@ const (
|
||||
// "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.
|
||||
// with ListServices. Amazon ECS services are cluster-specific and Region-specific.
|
||||
ErrCodeServiceNotFoundException = "ServiceNotFoundException"
|
||||
|
||||
// ErrCodeTargetNotFoundException for service response error code
|
||||
@@ -124,13 +130,21 @@ const (
|
||||
//
|
||||
// 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.
|
||||
// cluster-specific and Region-specific.
|
||||
ErrCodeTargetNotFoundException = "TargetNotFoundException"
|
||||
|
||||
// ErrCodeTaskSetNotFoundException for service response error code
|
||||
// "TaskSetNotFoundException".
|
||||
//
|
||||
// The specified task set could not be found. You can view your available container
|
||||
// instances with DescribeTaskSets. Task sets are specific to each cluster,
|
||||
// service and Region.
|
||||
ErrCodeTaskSetNotFoundException = "TaskSetNotFoundException"
|
||||
|
||||
// ErrCodeUnsupportedFeatureException for service response error code
|
||||
// "UnsupportedFeatureException".
|
||||
//
|
||||
// The specified task is not supported in this region.
|
||||
// The specified task is not supported in this Region.
|
||||
ErrCodeUnsupportedFeatureException = "UnsupportedFeatureException"
|
||||
|
||||
// ErrCodeUpdateInProgressException for service response error code
|
||||
|
||||
+367
-1
@@ -160,6 +160,76 @@ func ExampleECS_CreateService_shared01() {
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To delete your account setting
|
||||
//
|
||||
// This example deletes the account setting for your user for the specified resource
|
||||
// type.
|
||||
func ExampleECS_DeleteAccountSetting_shared00() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.DeleteAccountSettingInput{
|
||||
Name: aws.String("serviceLongArnFormat"),
|
||||
}
|
||||
|
||||
result, err := svc.DeleteAccountSetting(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case ecs.ErrCodeServerException:
|
||||
fmt.Println(ecs.ErrCodeServerException, aerr.Error())
|
||||
case ecs.ErrCodeClientException:
|
||||
fmt.Println(ecs.ErrCodeClientException, aerr.Error())
|
||||
case ecs.ErrCodeInvalidParameterException:
|
||||
fmt.Println(ecs.ErrCodeInvalidParameterException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To delete the account settings for a specific IAM user or IAM role
|
||||
//
|
||||
// This example deletes the account setting for a specific IAM user or IAM role for
|
||||
// the specified resource type. Only the root user can view or modify the account settings
|
||||
// for another user.
|
||||
func ExampleECS_DeleteAccountSetting_shared01() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.DeleteAccountSettingInput{
|
||||
Name: aws.String("containerInstanceLongArnFormat"),
|
||||
PrincipalArn: aws.String("arn:aws:iam::<aws_account_id>:user/principalName"),
|
||||
}
|
||||
|
||||
result, err := svc.DeleteAccountSetting(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case ecs.ErrCodeServerException:
|
||||
fmt.Println(ecs.ErrCodeServerException, aerr.Error())
|
||||
case ecs.ErrCodeClientException:
|
||||
fmt.Println(ecs.ErrCodeClientException, aerr.Error())
|
||||
case ecs.ErrCodeInvalidParameterException:
|
||||
fmt.Println(ecs.ErrCodeInvalidParameterException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To delete an empty cluster
|
||||
//
|
||||
// This example deletes an empty cluster in your default region.
|
||||
@@ -460,6 +530,73 @@ func ExampleECS_DescribeTasks_shared00() {
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To view your effective account settings
|
||||
//
|
||||
// This example displays the effective account settings for your account.
|
||||
func ExampleECS_ListAccountSettings_shared00() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.ListAccountSettingsInput{
|
||||
EffectiveSettings: aws.Bool(true),
|
||||
}
|
||||
|
||||
result, err := svc.ListAccountSettings(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case ecs.ErrCodeServerException:
|
||||
fmt.Println(ecs.ErrCodeServerException, aerr.Error())
|
||||
case ecs.ErrCodeClientException:
|
||||
fmt.Println(ecs.ErrCodeClientException, aerr.Error())
|
||||
case ecs.ErrCodeInvalidParameterException:
|
||||
fmt.Println(ecs.ErrCodeInvalidParameterException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To view the effective account settings for a specific IAM user or IAM role
|
||||
//
|
||||
// This example displays the effective account settings for the specified user or role.
|
||||
func ExampleECS_ListAccountSettings_shared01() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.ListAccountSettingsInput{
|
||||
EffectiveSettings: aws.Bool(true),
|
||||
PrincipalArn: aws.String("arn:aws:iam::<aws_account_id>:user/principalName"),
|
||||
}
|
||||
|
||||
result, err := svc.ListAccountSettings(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case ecs.ErrCodeServerException:
|
||||
fmt.Println(ecs.ErrCodeServerException, aerr.Error())
|
||||
case ecs.ErrCodeClientException:
|
||||
fmt.Println(ecs.ErrCodeClientException, aerr.Error())
|
||||
case ecs.ErrCodeInvalidParameterException:
|
||||
fmt.Println(ecs.ErrCodeInvalidParameterException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To list your available clusters
|
||||
//
|
||||
// This example lists all of your available clusters in your default region.
|
||||
@@ -560,6 +697,41 @@ func ExampleECS_ListServices_shared00() {
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To list the tags for a cluster.
|
||||
//
|
||||
// This example lists the tags for the 'dev' cluster.
|
||||
func ExampleECS_ListTagsForResource_shared00() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.ListTagsForResourceInput{
|
||||
ResourceArn: aws.String("arn:aws:ecs:region:aws_account_id:cluster/dev"),
|
||||
}
|
||||
|
||||
result, err := svc.ListTagsForResource(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case ecs.ErrCodeServerException:
|
||||
fmt.Println(ecs.ErrCodeServerException, aerr.Error())
|
||||
case ecs.ErrCodeClientException:
|
||||
fmt.Println(ecs.ErrCodeClientException, aerr.Error())
|
||||
case ecs.ErrCodeClusterNotFoundException:
|
||||
fmt.Println(ecs.ErrCodeClusterNotFoundException, aerr.Error())
|
||||
case ecs.ErrCodeInvalidParameterException:
|
||||
fmt.Println(ecs.ErrCodeInvalidParameterException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To list your registered task definition families
|
||||
//
|
||||
// This example lists all of your registered task definition families.
|
||||
@@ -728,7 +900,7 @@ func ExampleECS_ListTasks_shared00() {
|
||||
// To list the tasks on a particular container instance
|
||||
//
|
||||
// This example lists the tasks of a specified container instance. Specifying a ``containerInstance``
|
||||
// value limits the results to tasks that belong to that container instance.
|
||||
// value limits the results to tasks that belong to that container instance.
|
||||
func ExampleECS_ListTasks_shared01() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.ListTasksInput{
|
||||
@@ -764,6 +936,117 @@ func ExampleECS_ListTasks_shared01() {
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To modify your account settings
|
||||
//
|
||||
// This example modifies your account settings to opt in to the new ARN and resource
|
||||
// ID format for Amazon ECS services. If you’re using this command as the root user,
|
||||
// then changes apply to the entire AWS account, unless an IAM user or role explicitly
|
||||
// overrides these settings for themselves.
|
||||
func ExampleECS_PutAccountSetting_shared00() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.PutAccountSettingInput{
|
||||
Name: aws.String("serviceLongArnFormat"),
|
||||
Value: aws.String("enabled"),
|
||||
}
|
||||
|
||||
result, err := svc.PutAccountSetting(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case ecs.ErrCodeServerException:
|
||||
fmt.Println(ecs.ErrCodeServerException, aerr.Error())
|
||||
case ecs.ErrCodeClientException:
|
||||
fmt.Println(ecs.ErrCodeClientException, aerr.Error())
|
||||
case ecs.ErrCodeInvalidParameterException:
|
||||
fmt.Println(ecs.ErrCodeInvalidParameterException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To modify the account settings for a specific IAM user or IAM role
|
||||
//
|
||||
// This example modifies the account setting for a specific IAM user or IAM role to
|
||||
// opt in to the new ARN and resource ID format for Amazon ECS container instances.
|
||||
// If you’re using this command as the root user, then changes apply to the entire
|
||||
// AWS account, unless an IAM user or role explicitly overrides these settings for themselves.
|
||||
func ExampleECS_PutAccountSetting_shared01() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.PutAccountSettingInput{
|
||||
Name: aws.String("containerInstanceLongArnFormat"),
|
||||
PrincipalArn: aws.String("arn:aws:iam::<aws_account_id>:user/principalName"),
|
||||
Value: aws.String("enabled"),
|
||||
}
|
||||
|
||||
result, err := svc.PutAccountSetting(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case ecs.ErrCodeServerException:
|
||||
fmt.Println(ecs.ErrCodeServerException, aerr.Error())
|
||||
case ecs.ErrCodeClientException:
|
||||
fmt.Println(ecs.ErrCodeClientException, aerr.Error())
|
||||
case ecs.ErrCodeInvalidParameterException:
|
||||
fmt.Println(ecs.ErrCodeInvalidParameterException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To modify the default account settings for all IAM users or roles on an account
|
||||
//
|
||||
// This example modifies the default account setting for the specified resource for
|
||||
// all IAM users or roles on an account. These changes apply to the entire AWS account,
|
||||
// unless an IAM user or role explicitly overrides these settings for themselves.
|
||||
func ExampleECS_PutAccountSettingDefault_shared00() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.PutAccountSettingDefaultInput{
|
||||
Name: aws.String("serviceLongArnFormat"),
|
||||
Value: aws.String("enabled"),
|
||||
}
|
||||
|
||||
result, err := svc.PutAccountSettingDefault(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case ecs.ErrCodeServerException:
|
||||
fmt.Println(ecs.ErrCodeServerException, aerr.Error())
|
||||
case ecs.ErrCodeClientException:
|
||||
fmt.Println(ecs.ErrCodeClientException, aerr.Error())
|
||||
case ecs.ErrCodeInvalidParameterException:
|
||||
fmt.Println(ecs.ErrCodeInvalidParameterException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To register a task definition
|
||||
//
|
||||
// This example registers a task definition to the specified family.
|
||||
@@ -857,6 +1140,89 @@ func ExampleECS_RunTask_shared00() {
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To tag a cluster.
|
||||
//
|
||||
// This example tags the 'dev' cluster with key 'team' and value 'dev'.
|
||||
func ExampleECS_TagResource_shared00() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.TagResourceInput{
|
||||
ResourceArn: aws.String("arn:aws:ecs:region:aws_account_id:cluster/dev"),
|
||||
Tags: []*ecs.Tag{
|
||||
{
|
||||
Key: aws.String("team"),
|
||||
Value: aws.String("dev"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
result, err := svc.TagResource(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case ecs.ErrCodeServerException:
|
||||
fmt.Println(ecs.ErrCodeServerException, aerr.Error())
|
||||
case ecs.ErrCodeClientException:
|
||||
fmt.Println(ecs.ErrCodeClientException, aerr.Error())
|
||||
case ecs.ErrCodeClusterNotFoundException:
|
||||
fmt.Println(ecs.ErrCodeClusterNotFoundException, aerr.Error())
|
||||
case ecs.ErrCodeResourceNotFoundException:
|
||||
fmt.Println(ecs.ErrCodeResourceNotFoundException, aerr.Error())
|
||||
case ecs.ErrCodeInvalidParameterException:
|
||||
fmt.Println(ecs.ErrCodeInvalidParameterException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To untag a cluster.
|
||||
//
|
||||
// This example deletes the 'team' tag from the 'dev' cluster.
|
||||
func ExampleECS_UntagResource_shared00() {
|
||||
svc := ecs.New(session.New())
|
||||
input := &ecs.UntagResourceInput{
|
||||
ResourceArn: aws.String("arn:aws:ecs:region:aws_account_id:cluster/dev"),
|
||||
TagKeys: []*string{
|
||||
aws.String("team"),
|
||||
},
|
||||
}
|
||||
|
||||
result, err := svc.UntagResource(input)
|
||||
if err != nil {
|
||||
if aerr, ok := err.(awserr.Error); ok {
|
||||
switch aerr.Code() {
|
||||
case ecs.ErrCodeServerException:
|
||||
fmt.Println(ecs.ErrCodeServerException, aerr.Error())
|
||||
case ecs.ErrCodeClientException:
|
||||
fmt.Println(ecs.ErrCodeClientException, aerr.Error())
|
||||
case ecs.ErrCodeClusterNotFoundException:
|
||||
fmt.Println(ecs.ErrCodeClusterNotFoundException, aerr.Error())
|
||||
case ecs.ErrCodeResourceNotFoundException:
|
||||
fmt.Println(ecs.ErrCodeResourceNotFoundException, aerr.Error())
|
||||
case ecs.ErrCodeInvalidParameterException:
|
||||
fmt.Println(ecs.ErrCodeInvalidParameterException, aerr.Error())
|
||||
default:
|
||||
fmt.Println(aerr.Error())
|
||||
}
|
||||
} else {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To change the task definition used in a service
|
||||
//
|
||||
// This example updates the my-http-service service to use the amazon-ecs-sample task
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// +build go1.10,integration
|
||||
|
||||
package ecs_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting/integration"
|
||||
"github.com/aws/aws-sdk-go/service/ecs"
|
||||
)
|
||||
|
||||
var _ aws.Config
|
||||
var _ awserr.Error
|
||||
var _ request.Request
|
||||
|
||||
func TestInteg_00_ListClusters(t *testing.T) {
|
||||
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancelFn()
|
||||
|
||||
sess := integration.SessionWithDefaultRegion("us-west-2")
|
||||
svc := ecs.New(sess)
|
||||
params := &ecs.ListClustersInput{}
|
||||
_, err := svc.ListClustersWithContext(ctx, params)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
}
|
||||
func TestInteg_01_StopTask(t *testing.T) {
|
||||
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancelFn()
|
||||
|
||||
sess := integration.SessionWithDefaultRegion("us-west-2")
|
||||
svc := ecs.New(sess)
|
||||
params := &ecs.StopTaskInput{
|
||||
Task: aws.String("xxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxx"),
|
||||
}
|
||||
_, err := svc.StopTaskWithContext(ctx, params)
|
||||
if err == nil {
|
||||
t.Fatalf("expect request to fail")
|
||||
}
|
||||
aerr, ok := err.(awserr.RequestFailure)
|
||||
if !ok {
|
||||
t.Fatalf("expect awserr, was %T", err)
|
||||
}
|
||||
if len(aerr.Code()) == 0 {
|
||||
t.Errorf("expect non-empty error code")
|
||||
}
|
||||
if v := aerr.Code(); v == request.ErrCodeSerialization {
|
||||
t.Errorf("expect API error code got serialization failure")
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -29,8 +29,9 @@ var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "ecs" // Service endpoint prefix API calls made to.
|
||||
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
|
||||
ServiceName = "ecs" // Name of service.
|
||||
EndpointsID = ServiceName // ID to lookup a service endpoint with.
|
||||
ServiceID = "ECS" // ServiceID is a unique identifer of a specific service.
|
||||
)
|
||||
|
||||
// New creates a new instance of the ECS client with a session.
|
||||
@@ -55,6 +56,7 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
ServiceID: ServiceID,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
|
||||
Reference in New Issue
Block a user