func ExampleECS_ListTasks() { svc := ecs.New(nil) params := &ecs.ListTasksInput{ Cluster: aws.String("String"), ContainerInstance: aws.String("String"), Family: aws.String("String"), MaxResults: aws.Long(1), NextToken: aws.String("String"), ServiceName: aws.String("String"), StartedBy: aws.String("String"), } resp, err := svc.ListTasks(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS Error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, The SDK should alwsy return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleECS_UpdateService() { svc := ecs.New(nil) params := &ecs.UpdateServiceInput{ Service: aws.String("String"), // Required Cluster: aws.String("String"), DesiredCount: aws.Long(1), TaskDefinition: aws.String("String"), } resp, err := svc.UpdateService(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS Error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, The SDK should alwsy return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleECS_DescribeContainerInstances() { svc := ecs.New(nil) params := &ecs.DescribeContainerInstancesInput{ ContainerInstances: []*string{ // Required aws.String("String"), // Required // More values... }, Cluster: aws.String("String"), } resp, err := svc.DescribeContainerInstances(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS Error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, The SDK should alwsy return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleECS_RegisterContainerInstance() { svc := ecs.New(nil) params := &ecs.RegisterContainerInstanceInput{ Cluster: aws.String("String"), InstanceIdentityDocument: aws.String("String"), InstanceIdentityDocumentSignature: aws.String("String"), TotalResources: []*ecs.Resource{ &ecs.Resource{ // Required DoubleValue: aws.Double(1.0), IntegerValue: aws.Long(1), LongValue: aws.Long(1), Name: aws.String("String"), StringSetValue: []*string{ aws.String("String"), // Required // More values... }, Type: aws.String("String"), }, // More values... }, VersionInfo: &ecs.VersionInfo{ AgentHash: aws.String("String"), AgentVersion: aws.String("String"), DockerVersion: aws.String("String"), }, } resp, err := svc.RegisterContainerInstance(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS Error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, The SDK should alwsy return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleECS_RunTask() { svc := ecs.New(nil) params := &ecs.RunTaskInput{ TaskDefinition: aws.String("String"), // Required Cluster: aws.String("String"), Count: aws.Long(1), Overrides: &ecs.TaskOverride{ ContainerOverrides: []*ecs.ContainerOverride{ &ecs.ContainerOverride{ // Required Command: []*string{ aws.String("String"), // Required // More values... }, Name: aws.String("String"), }, // More values... }, }, StartedBy: aws.String("String"), } resp, err := svc.RunTask(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS Error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, The SDK should alwsy return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleECS_SubmitContainerStateChange() { svc := ecs.New(nil) params := &ecs.SubmitContainerStateChangeInput{ Cluster: aws.String("String"), ContainerName: aws.String("String"), ExitCode: aws.Long(1), NetworkBindings: []*ecs.NetworkBinding{ &ecs.NetworkBinding{ // Required BindIP: aws.String("String"), ContainerPort: aws.Long(1), HostPort: aws.Long(1), }, // More values... }, Reason: aws.String("String"), Status: aws.String("String"), Task: aws.String("String"), } resp, err := svc.SubmitContainerStateChange(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS Error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, The SDK should alwsy return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func TestInterface(t *testing.T) { assert.Implements(t, (*ecsiface.ECSAPI)(nil), ecs.New(nil)) }
func ExampleECS_RegisterTaskDefinition() { svc := ecs.New(nil) params := &ecs.RegisterTaskDefinitionInput{ ContainerDefinitions: []*ecs.ContainerDefinition{ // Required &ecs.ContainerDefinition{ // Required CPU: aws.Long(1), Command: []*string{ aws.String("String"), // Required // More values... }, EntryPoint: []*string{ aws.String("String"), // Required // More values... }, Environment: []*ecs.KeyValuePair{ &ecs.KeyValuePair{ // Required Name: aws.String("String"), Value: aws.String("String"), }, // More values... }, Essential: aws.Boolean(true), Image: aws.String("String"), Links: []*string{ aws.String("String"), // Required // More values... }, Memory: aws.Long(1), MountPoints: []*ecs.MountPoint{ &ecs.MountPoint{ // Required ContainerPath: aws.String("String"), ReadOnly: aws.Boolean(true), SourceVolume: aws.String("String"), }, // More values... }, Name: aws.String("String"), PortMappings: []*ecs.PortMapping{ &ecs.PortMapping{ // Required ContainerPort: aws.Long(1), HostPort: aws.Long(1), }, // More values... }, VolumesFrom: []*ecs.VolumeFrom{ &ecs.VolumeFrom{ // Required ReadOnly: aws.Boolean(true), SourceContainer: aws.String("String"), }, // More values... }, }, // More values... }, Family: aws.String("String"), // Required Volumes: []*ecs.Volume{ &ecs.Volume{ // Required Host: &ecs.HostVolumeProperties{ SourcePath: aws.String("String"), }, Name: aws.String("String"), }, // More values... }, } resp, err := svc.RegisterTaskDefinition(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS Error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, The SDK should alwsy return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ECS(req Request) *ecs.ECS { return ecs.New(&aws.Config{ Credentials: Credentials(&req), Region: Region(&req), }) }
func ECS() *ecs.ECS { return ecs.New(&aws.Config{ Credentials: credentials.NewCredentials(&AwsCredentials{}), Region: os.Getenv("AWS_REGION"), }) }