AWS SDK for Go (PILOT)
API Reference

PREVIEW DOCUMENTATION - This is a preview of a new format for the AWS SDK for Go API Reference documentation. For the current AWS SDK for Go API Reference, see https://docs.aws.amazon.com/sdk-for-go/api/.

We welcome your feedback on this new version of the documentation. Send your comments to aws-sdkdocs-feedback@amazon.com.

Batch

import "github.com/aws/aws-sdk-go/service/batch"

type Batch struct { *client.Client }

Batch provides the API operation methods for making requests to AWS Batch. See this package's package overview docs for details on the service.

Batch methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

Client

Type: *client.Client

Method

CancelJob

func (c *Batch) CancelJob(input *CancelJobInput) (*CancelJobOutput, error)

CancelJob API operation for AWS Batch.

Cancels a job in an AWS Batch job queue. Jobs that are in the SUBMITTED, PENDING, or RUNNABLE state are cancelled. Jobs that have progressed to STARTING or RUNNING are not cancelled (but the API operation still succeeds, even if no job is cancelled); these jobs must be terminated with the TerminateJob operation.

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 the error.

See the AWS API reference guide for AWS Batch's API operation CancelJob for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/CancelJob

Example

Batch CancelJob shared00

To cancel a job

This example cancels a job with the specified job ID.

{ svc := batch.New(session.New()) input := &batch.CancelJobInput{ JobId: aws.String("1d828f65-7a4d-42e8-996d-3b900ed59dc4"), Reason: aws.String("Cancelling job."), } result, err := svc.CancelJob(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CancelJobRequest

func (c *Batch) CancelJobRequest(input *CancelJobInput) (req *request.Request, output *CancelJobOutput)

CancelJobRequest generates a "aws/request.Request" representing the client's request for the CancelJob operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CancelJob for more information on using the CancelJob API call, and error handling.

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 CancelJobRequest method. req, resp := client.CancelJobRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/CancelJob

CancelJobWithContext

func (c *Batch) CancelJobWithContext(ctx aws.Context, input *CancelJobInput, opts ...request.Option) (*CancelJobOutput, error)

CancelJobWithContext is the same as CancelJob with the addition of the ability to pass a context and additional request options.

See CancelJob for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CreateComputeEnvironment

func (c *Batch) CreateComputeEnvironment(input *CreateComputeEnvironmentInput) (*CreateComputeEnvironmentOutput, error)

CreateComputeEnvironment API operation for AWS Batch.

Creates an AWS Batch compute environment. You can create MANAGED or UNMANAGED compute environments.

In a managed compute environment, AWS Batch manages the capacity and instance types of the compute resources within the environment. This is based on the compute resource specification that you define or the launch template (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html) that you specify when you create the compute environment. You can choose to use Amazon EC2 On-Demand Instances or Spot Instances in your managed compute environment. You can optionally set a maximum price so that Spot Instances only launch when the Spot Instance price is below a specified percentage of the On-Demand price.

Multi-node parallel jobs are not supported on Spot Instances.

In an unmanaged compute environment, you can manage your own compute resources. This provides more compute resource configuration options, such as using a custom AMI, but you must ensure that your AMI meets the Amazon ECS container instance AMI specification. For more information, see Container Instance AMIs (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container_instance_AMIs.html) in the Amazon Elastic Container Service Developer Guide. After you have created your unmanaged compute environment, you can use the DescribeComputeEnvironments operation to find the Amazon ECS cluster that is associated with it. Then, manually launch your container instances into that Amazon ECS cluster. For more information, see Launching an Amazon ECS Container Instance (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html) in the Amazon Elastic Container Service Developer Guide.

AWS Batch does not upgrade the AMIs in a compute environment after it is created (for example, when a newer version of the Amazon ECS-optimized AMI is available). You are responsible for the management of the guest operating system (including updates and security patches) and any additional application software or utilities that you install on the compute resources. To use a new AMI for your AWS Batch jobs:

Create a new compute environment with the new AMI.

Add the compute environment to an existing job queue.

Remove the old compute environment from your job queue.

Delete the old compute environment.

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 the error.

See the AWS API reference guide for AWS Batch's API operation CreateComputeEnvironment for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/CreateComputeEnvironment

Examples

Batch CreateComputeEnvironment shared00

To create a managed EC2 compute environment

This example creates a managed compute environment with specific C4 instance types that are launched on demand. The compute environment is called C4OnDemand.

{ svc := batch.New(session.New()) input := &batch.CreateComputeEnvironmentInput{ ComputeEnvironmentName: aws.String("C4OnDemand"), ComputeResources: &batch.ComputeResource{ DesiredvCpus: aws.Int64(48), Ec2KeyPair: aws.String("id_rsa"), InstanceRole: aws.String("ecsInstanceRole"), InstanceTypes: []*string{ aws.String("c4.large"), aws.String("c4.xlarge"), aws.String("c4.2xlarge"), aws.String("c4.4xlarge"), aws.String("c4.8xlarge"), }, MaxvCpus: aws.Int64(128), MinvCpus: aws.Int64(0), SecurityGroupIds: []*string{ aws.String("sg-cf5093b2"), }, Subnets: []*string{ aws.String("subnet-220c0e0a"), aws.String("subnet-1a95556d"), aws.String("subnet-978f6dce"), }, Tags: map[string]*string{ "Name": aws.String("Batch Instance - C4OnDemand"), }, Type: aws.String("EC2"), }, ServiceRole: aws.String("arn:aws:iam::012345678910:role/AWSBatchServiceRole"), State: aws.String("ENABLED"), Type: aws.String("MANAGED"), } result, err := svc.CreateComputeEnvironment(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
Batch CreateComputeEnvironment shared01

To create a managed EC2 Spot compute environment

This example creates a managed compute environment with the M4 instance type that is launched when the Spot bid price is at or below 20% of the On-Demand price for the instance type. The compute environment is called M4Spot.

{ svc := batch.New(session.New()) input := &batch.CreateComputeEnvironmentInput{ ComputeEnvironmentName: aws.String("M4Spot"), ComputeResources: &batch.ComputeResource{ BidPercentage: aws.Int64(20), DesiredvCpus: aws.Int64(4), Ec2KeyPair: aws.String("id_rsa"), InstanceRole: aws.String("ecsInstanceRole"), InstanceTypes: []*string{ aws.String("m4"), }, MaxvCpus: aws.Int64(128), MinvCpus: aws.Int64(0), SecurityGroupIds: []*string{ aws.String("sg-cf5093b2"), }, SpotIamFleetRole: aws.String("arn:aws:iam::012345678910:role/aws-ec2-spot-fleet-role"), Subnets: []*string{ aws.String("subnet-220c0e0a"), aws.String("subnet-1a95556d"), aws.String("subnet-978f6dce"), }, Tags: map[string]*string{ "Name": aws.String("Batch Instance - M4Spot"), }, Type: aws.String("SPOT"), }, ServiceRole: aws.String("arn:aws:iam::012345678910:role/AWSBatchServiceRole"), State: aws.String("ENABLED"), Type: aws.String("MANAGED"), } result, err := svc.CreateComputeEnvironment(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CreateComputeEnvironmentRequest

func (c *Batch) CreateComputeEnvironmentRequest(input *CreateComputeEnvironmentInput) (req *request.Request, output *CreateComputeEnvironmentOutput)

CreateComputeEnvironmentRequest generates a "aws/request.Request" representing the client's request for the CreateComputeEnvironment operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateComputeEnvironment for more information on using the CreateComputeEnvironment API call, and error handling.

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 CreateComputeEnvironmentRequest method. req, resp := client.CreateComputeEnvironmentRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/CreateComputeEnvironment

CreateComputeEnvironmentWithContext

func (c *Batch) CreateComputeEnvironmentWithContext(ctx aws.Context, input *CreateComputeEnvironmentInput, opts ...request.Option) (*CreateComputeEnvironmentOutput, error)

CreateComputeEnvironmentWithContext is the same as CreateComputeEnvironment with the addition of the ability to pass a context and additional request options.

See CreateComputeEnvironment for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CreateJobQueue

func (c *Batch) CreateJobQueue(input *CreateJobQueueInput) (*CreateJobQueueOutput, error)

CreateJobQueue API operation for AWS Batch.

Creates an AWS Batch job queue. When you create a job queue, you associate one or more compute environments to the queue and assign an order of preference for the compute environments.

You also set a priority to the job queue that determines the order in which the AWS Batch scheduler places jobs onto its associated compute environments. For example, if a compute environment is associated with more than one job queue, the job queue with a higher priority is given preference for scheduling jobs to that compute environment.

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 the error.

See the AWS API reference guide for AWS Batch's API operation CreateJobQueue for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/CreateJobQueue

Examples

Batch CreateJobQueue shared00

To create a job queue with a single compute environment

This example creates a job queue called LowPriority that uses the M4Spot compute environment.

{ svc := batch.New(session.New()) input := &batch.CreateJobQueueInput{ ComputeEnvironmentOrder: []*batch.ComputeEnvironmentOrder{ { ComputeEnvironment: aws.String("M4Spot"), Order: aws.Int64(1), }, }, JobQueueName: aws.String("LowPriority"), Priority: aws.Int64(1), State: aws.String("ENABLED"), } result, err := svc.CreateJobQueue(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
Batch CreateJobQueue shared01

To create a job queue with multiple compute environments

This example creates a job queue called HighPriority that uses the C4OnDemand compute environment with an order of 1 and the M4Spot compute environment with an order of 2.

{ svc := batch.New(session.New()) input := &batch.CreateJobQueueInput{ ComputeEnvironmentOrder: []*batch.ComputeEnvironmentOrder{ { ComputeEnvironment: aws.String("C4OnDemand"), Order: aws.Int64(1), }, { ComputeEnvironment: aws.String("M4Spot"), Order: aws.Int64(2), }, }, JobQueueName: aws.String("HighPriority"), Priority: aws.Int64(10), State: aws.String("ENABLED"), } result, err := svc.CreateJobQueue(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CreateJobQueueRequest

func (c *Batch) CreateJobQueueRequest(input *CreateJobQueueInput) (req *request.Request, output *CreateJobQueueOutput)

CreateJobQueueRequest generates a "aws/request.Request" representing the client's request for the CreateJobQueue operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateJobQueue for more information on using the CreateJobQueue API call, and error handling.

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 CreateJobQueueRequest method. req, resp := client.CreateJobQueueRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/CreateJobQueue

CreateJobQueueWithContext

func (c *Batch) CreateJobQueueWithContext(ctx aws.Context, input *CreateJobQueueInput, opts ...request.Option) (*CreateJobQueueOutput, error)

CreateJobQueueWithContext is the same as CreateJobQueue with the addition of the ability to pass a context and additional request options.

See CreateJobQueue for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeleteComputeEnvironment

func (c *Batch) DeleteComputeEnvironment(input *DeleteComputeEnvironmentInput) (*DeleteComputeEnvironmentOutput, error)

DeleteComputeEnvironment API operation for AWS Batch.

Deletes an AWS Batch compute environment.

Before you can delete a compute environment, you must set its state to DISABLED with the UpdateComputeEnvironment API operation and disassociate it from any job queues with the UpdateJobQueue API operation.

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 the error.

See the AWS API reference guide for AWS Batch's API operation DeleteComputeEnvironment for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DeleteComputeEnvironment

Example

Batch DeleteComputeEnvironment shared00

To delete a compute environment

This example deletes the P2OnDemand compute environment.

{ svc := batch.New(session.New()) input := &batch.DeleteComputeEnvironmentInput{ ComputeEnvironment: aws.String("P2OnDemand"), } result, err := svc.DeleteComputeEnvironment(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeleteComputeEnvironmentRequest

func (c *Batch) DeleteComputeEnvironmentRequest(input *DeleteComputeEnvironmentInput) (req *request.Request, output *DeleteComputeEnvironmentOutput)

DeleteComputeEnvironmentRequest generates a "aws/request.Request" representing the client's request for the DeleteComputeEnvironment operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteComputeEnvironment for more information on using the DeleteComputeEnvironment API call, and error handling.

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 DeleteComputeEnvironmentRequest method. req, resp := client.DeleteComputeEnvironmentRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DeleteComputeEnvironment

DeleteComputeEnvironmentWithContext

func (c *Batch) DeleteComputeEnvironmentWithContext(ctx aws.Context, input *DeleteComputeEnvironmentInput, opts ...request.Option) (*DeleteComputeEnvironmentOutput, error)

DeleteComputeEnvironmentWithContext is the same as DeleteComputeEnvironment with the addition of the ability to pass a context and additional request options.

See DeleteComputeEnvironment for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeleteJobQueue

func (c *Batch) DeleteJobQueue(input *DeleteJobQueueInput) (*DeleteJobQueueOutput, error)

DeleteJobQueue API operation for AWS Batch.

Deletes the specified job queue. You must first disable submissions for a queue with the UpdateJobQueue operation. All jobs in the queue are terminated when you delete a job queue.

It is not necessary to disassociate compute environments from a queue before submitting a DeleteJobQueue request.

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 the error.

See the AWS API reference guide for AWS Batch's API operation DeleteJobQueue for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DeleteJobQueue

Example

Batch DeleteJobQueue shared00

To delete a job queue

This example deletes the GPGPU job queue.

{ svc := batch.New(session.New()) input := &batch.DeleteJobQueueInput{ JobQueue: aws.String("GPGPU"), } result, err := svc.DeleteJobQueue(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeleteJobQueueRequest

func (c *Batch) DeleteJobQueueRequest(input *DeleteJobQueueInput) (req *request.Request, output *DeleteJobQueueOutput)

DeleteJobQueueRequest generates a "aws/request.Request" representing the client's request for the DeleteJobQueue operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteJobQueue for more information on using the DeleteJobQueue API call, and error handling.

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 DeleteJobQueueRequest method. req, resp := client.DeleteJobQueueRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DeleteJobQueue

DeleteJobQueueWithContext

func (c *Batch) DeleteJobQueueWithContext(ctx aws.Context, input *DeleteJobQueueInput, opts ...request.Option) (*DeleteJobQueueOutput, error)

DeleteJobQueueWithContext is the same as DeleteJobQueue with the addition of the ability to pass a context and additional request options.

See DeleteJobQueue for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeregisterJobDefinition

func (c *Batch) DeregisterJobDefinition(input *DeregisterJobDefinitionInput) (*DeregisterJobDefinitionOutput, error)

DeregisterJobDefinition API operation for AWS Batch.

Deregisters an AWS Batch job definition.

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 the error.

See the AWS API reference guide for AWS Batch's API operation DeregisterJobDefinition for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DeregisterJobDefinition

Example

Batch DeregisterJobDefinition shared00

To deregister a job definition

This example deregisters a job definition called sleep10.

{ svc := batch.New(session.New()) input := &batch.DeregisterJobDefinitionInput{ JobDefinition: aws.String("sleep10"), } result, err := svc.DeregisterJobDefinition(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeregisterJobDefinitionRequest

func (c *Batch) DeregisterJobDefinitionRequest(input *DeregisterJobDefinitionInput) (req *request.Request, output *DeregisterJobDefinitionOutput)

DeregisterJobDefinitionRequest generates a "aws/request.Request" representing the client's request for the DeregisterJobDefinition operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeregisterJobDefinition for more information on using the DeregisterJobDefinition API call, and error handling.

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 DeregisterJobDefinitionRequest method. req, resp := client.DeregisterJobDefinitionRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DeregisterJobDefinition

DeregisterJobDefinitionWithContext

func (c *Batch) DeregisterJobDefinitionWithContext(ctx aws.Context, input *DeregisterJobDefinitionInput, opts ...request.Option) (*DeregisterJobDefinitionOutput, error)

DeregisterJobDefinitionWithContext is the same as DeregisterJobDefinition with the addition of the ability to pass a context and additional request options.

See DeregisterJobDefinition for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeComputeEnvironments

func (c *Batch) DescribeComputeEnvironments(input *DescribeComputeEnvironmentsInput) (*DescribeComputeEnvironmentsOutput, error)

DescribeComputeEnvironments API operation for AWS Batch.

Describes one or more of your compute environments.

If you are using an unmanaged compute environment, you can use the DescribeComputeEnvironment operation to determine the ecsClusterArn that you should launch your Amazon ECS container instances into.

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 the error.

See the AWS API reference guide for AWS Batch's API operation DescribeComputeEnvironments for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DescribeComputeEnvironments

Example

Batch DescribeComputeEnvironments shared00

To describe a compute environment

This example describes the P2OnDemand compute environment.

{ svc := batch.New(session.New()) input := &batch.DescribeComputeEnvironmentsInput{ ComputeEnvironments: []*string{ aws.String("P2OnDemand"), }, } result, err := svc.DescribeComputeEnvironments(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeComputeEnvironmentsRequest

func (c *Batch) DescribeComputeEnvironmentsRequest(input *DescribeComputeEnvironmentsInput) (req *request.Request, output *DescribeComputeEnvironmentsOutput)

DescribeComputeEnvironmentsRequest generates a "aws/request.Request" representing the client's request for the DescribeComputeEnvironments operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeComputeEnvironments for more information on using the DescribeComputeEnvironments API call, and error handling.

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 DescribeComputeEnvironmentsRequest method. req, resp := client.DescribeComputeEnvironmentsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DescribeComputeEnvironments

DescribeComputeEnvironmentsWithContext

func (c *Batch) DescribeComputeEnvironmentsWithContext(ctx aws.Context, input *DescribeComputeEnvironmentsInput, opts ...request.Option) (*DescribeComputeEnvironmentsOutput, error)

DescribeComputeEnvironmentsWithContext is the same as DescribeComputeEnvironments with the addition of the ability to pass a context and additional request options.

See DescribeComputeEnvironments for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeJobDefinitions

func (c *Batch) DescribeJobDefinitions(input *DescribeJobDefinitionsInput) (*DescribeJobDefinitionsOutput, error)

DescribeJobDefinitions API operation for AWS Batch.

Describes a list of job definitions. You can specify a status (such as ACTIVE) to only return job definitions that match that status.

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 the error.

See the AWS API reference guide for AWS Batch's API operation DescribeJobDefinitions for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DescribeJobDefinitions

Example

Batch DescribeJobDefinitions shared00

To describe active job definitions

This example describes all of your active job definitions.

{ svc := batch.New(session.New()) input := &batch.DescribeJobDefinitionsInput{ Status: aws.String("ACTIVE"), } result, err := svc.DescribeJobDefinitions(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeJobDefinitionsRequest

func (c *Batch) DescribeJobDefinitionsRequest(input *DescribeJobDefinitionsInput) (req *request.Request, output *DescribeJobDefinitionsOutput)

DescribeJobDefinitionsRequest generates a "aws/request.Request" representing the client's request for the DescribeJobDefinitions operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeJobDefinitions for more information on using the DescribeJobDefinitions API call, and error handling.

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 DescribeJobDefinitionsRequest method. req, resp := client.DescribeJobDefinitionsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DescribeJobDefinitions

DescribeJobDefinitionsWithContext

func (c *Batch) DescribeJobDefinitionsWithContext(ctx aws.Context, input *DescribeJobDefinitionsInput, opts ...request.Option) (*DescribeJobDefinitionsOutput, error)

DescribeJobDefinitionsWithContext is the same as DescribeJobDefinitions with the addition of the ability to pass a context and additional request options.

See DescribeJobDefinitions for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeJobQueues

func (c *Batch) DescribeJobQueues(input *DescribeJobQueuesInput) (*DescribeJobQueuesOutput, error)

DescribeJobQueues API operation for AWS Batch.

Describes one or more of your job queues.

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 the error.

See the AWS API reference guide for AWS Batch's API operation DescribeJobQueues for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DescribeJobQueues

Example

Batch DescribeJobQueues shared00

To describe a job queue

This example describes the HighPriority job queue.

{ svc := batch.New(session.New()) input := &batch.DescribeJobQueuesInput{ JobQueues: []*string{ aws.String("HighPriority"), }, } result, err := svc.DescribeJobQueues(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeJobQueuesRequest

func (c *Batch) DescribeJobQueuesRequest(input *DescribeJobQueuesInput) (req *request.Request, output *DescribeJobQueuesOutput)

DescribeJobQueuesRequest generates a "aws/request.Request" representing the client's request for the DescribeJobQueues operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeJobQueues for more information on using the DescribeJobQueues API call, and error handling.

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 DescribeJobQueuesRequest method. req, resp := client.DescribeJobQueuesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DescribeJobQueues

DescribeJobQueuesWithContext

func (c *Batch) DescribeJobQueuesWithContext(ctx aws.Context, input *DescribeJobQueuesInput, opts ...request.Option) (*DescribeJobQueuesOutput, error)

DescribeJobQueuesWithContext is the same as DescribeJobQueues with the addition of the ability to pass a context and additional request options.

See DescribeJobQueues for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeJobs

func (c *Batch) DescribeJobs(input *DescribeJobsInput) (*DescribeJobsOutput, error)

DescribeJobs API operation for AWS Batch.

Describes a list of AWS Batch jobs.

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 the error.

See the AWS API reference guide for AWS Batch's API operation DescribeJobs for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DescribeJobs

Example

Batch DescribeJobs shared00

To describe a specific job

This example describes a job with the specified job ID.

{ svc := batch.New(session.New()) input := &batch.DescribeJobsInput{ Jobs: []*string{ aws.String("24fa2d7a-64c4-49d2-8b47-f8da4fbde8e9"), }, } result, err := svc.DescribeJobs(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeJobsRequest

func (c *Batch) DescribeJobsRequest(input *DescribeJobsInput) (req *request.Request, output *DescribeJobsOutput)

DescribeJobsRequest generates a "aws/request.Request" representing the client's request for the DescribeJobs operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeJobs for more information on using the DescribeJobs API call, and error handling.

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 DescribeJobsRequest method. req, resp := client.DescribeJobsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/DescribeJobs

DescribeJobsWithContext

func (c *Batch) DescribeJobsWithContext(ctx aws.Context, input *DescribeJobsInput, opts ...request.Option) (*DescribeJobsOutput, error)

DescribeJobsWithContext is the same as DescribeJobs with the addition of the ability to pass a context and additional request options.

See DescribeJobs for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListJobs

func (c *Batch) ListJobs(input *ListJobsInput) (*ListJobsOutput, error)

ListJobs API operation for AWS Batch.

Returns a list of AWS Batch jobs.

You must specify only one of the following:

  • a job queue ID to return a list of jobs in that job queue

  • a multi-node parallel job ID to return a list of that job's nodes

  • an array job ID to return a list of that job's children

You can filter the results by job status with the jobStatus parameter. If you do not specify a status, only RUNNING jobs are returned.

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 the error.

See the AWS API reference guide for AWS Batch's API operation ListJobs for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/ListJobs

Examples

Batch ListJobs shared00

To list running jobs

This example lists the running jobs in the HighPriority job queue.

{ svc := batch.New(session.New()) input := &batch.ListJobsInput{ JobQueue: aws.String("HighPriority"), } result, err := svc.ListJobs(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
Batch ListJobs shared01

To list submitted jobs

This example lists jobs in the HighPriority job queue that are in the SUBMITTED job status.

{ svc := batch.New(session.New()) input := &batch.ListJobsInput{ JobQueue: aws.String("HighPriority"), JobStatus: aws.String("SUBMITTED"), } result, err := svc.ListJobs(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ListJobsRequest

func (c *Batch) ListJobsRequest(input *ListJobsInput) (req *request.Request, output *ListJobsOutput)

ListJobsRequest generates a "aws/request.Request" representing the client's request for the ListJobs operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ListJobs for more information on using the ListJobs API call, and error handling.

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 ListJobsRequest method. req, resp := client.ListJobsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/ListJobs

ListJobsWithContext

func (c *Batch) ListJobsWithContext(ctx aws.Context, input *ListJobsInput, opts ...request.Option) (*ListJobsOutput, error)

ListJobsWithContext is the same as ListJobs with the addition of the ability to pass a context and additional request options.

See ListJobs for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

RegisterJobDefinition

func (c *Batch) RegisterJobDefinition(input *RegisterJobDefinitionInput) (*RegisterJobDefinitionOutput, error)

RegisterJobDefinition API operation for AWS Batch.

Registers an AWS Batch job definition.

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 the error.

See the AWS API reference guide for AWS Batch's API operation RegisterJobDefinition for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/RegisterJobDefinition

Example

Batch RegisterJobDefinition shared00

To register a job definition

This example registers a job definition for a simple container job.

{ svc := batch.New(session.New()) input := &batch.RegisterJobDefinitionInput{ ContainerProperties: &batch.ContainerProperties{ Command: []*string{ aws.String("sleep"), aws.String("10"), }, Image: aws.String("busybox"), Memory: aws.Int64(128), Vcpus: aws.Int64(1), }, JobDefinitionName: aws.String("sleep10"), Type: aws.String("container"), } result, err := svc.RegisterJobDefinition(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

RegisterJobDefinitionRequest

func (c *Batch) RegisterJobDefinitionRequest(input *RegisterJobDefinitionInput) (req *request.Request, output *RegisterJobDefinitionOutput)

RegisterJobDefinitionRequest generates a "aws/request.Request" representing the client's request for the RegisterJobDefinition operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See RegisterJobDefinition for more information on using the RegisterJobDefinition API call, and error handling.

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 RegisterJobDefinitionRequest method. req, resp := client.RegisterJobDefinitionRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/RegisterJobDefinition

RegisterJobDefinitionWithContext

func (c *Batch) RegisterJobDefinitionWithContext(ctx aws.Context, input *RegisterJobDefinitionInput, opts ...request.Option) (*RegisterJobDefinitionOutput, error)

RegisterJobDefinitionWithContext is the same as RegisterJobDefinition with the addition of the ability to pass a context and additional request options.

See RegisterJobDefinition for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

SubmitJob

func (c *Batch) SubmitJob(input *SubmitJobInput) (*SubmitJobOutput, error)

SubmitJob API operation for AWS Batch.

Submits an AWS Batch job from a job definition. Parameters specified during SubmitJob override parameters defined in the job definition.

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 the error.

See the AWS API reference guide for AWS Batch's API operation SubmitJob for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/SubmitJob

Example

Batch SubmitJob shared00

To submit a job to a queue

This example submits a simple container job called example to the HighPriority job queue.

{ svc := batch.New(session.New()) input := &batch.SubmitJobInput{ JobDefinition: aws.String("sleep60"), JobName: aws.String("example"), JobQueue: aws.String("HighPriority"), } result, err := svc.SubmitJob(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

SubmitJobRequest

func (c *Batch) SubmitJobRequest(input *SubmitJobInput) (req *request.Request, output *SubmitJobOutput)

SubmitJobRequest generates a "aws/request.Request" representing the client's request for the SubmitJob operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See SubmitJob for more information on using the SubmitJob API call, and error handling.

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 SubmitJobRequest method. req, resp := client.SubmitJobRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/SubmitJob

SubmitJobWithContext

func (c *Batch) SubmitJobWithContext(ctx aws.Context, input *SubmitJobInput, opts ...request.Option) (*SubmitJobOutput, error)

SubmitJobWithContext is the same as SubmitJob with the addition of the ability to pass a context and additional request options.

See SubmitJob for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

TerminateJob

func (c *Batch) TerminateJob(input *TerminateJobInput) (*TerminateJobOutput, error)

TerminateJob API operation for AWS Batch.

Terminates a job in a job queue. Jobs that are in the STARTING or RUNNING state are terminated, which causes them to transition to FAILED. Jobs that have not progressed to the STARTING state are cancelled.

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 the error.

See the AWS API reference guide for AWS Batch's API operation TerminateJob for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/TerminateJob

Example

Batch TerminateJob shared00

To terminate a job

This example terminates a job with the specified job ID.

{ svc := batch.New(session.New()) input := &batch.TerminateJobInput{ JobId: aws.String("61e743ed-35e4-48da-b2de-5c8333821c84"), Reason: aws.String("Terminating job."), } result, err := svc.TerminateJob(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

TerminateJobRequest

func (c *Batch) TerminateJobRequest(input *TerminateJobInput) (req *request.Request, output *TerminateJobOutput)

TerminateJobRequest generates a "aws/request.Request" representing the client's request for the TerminateJob operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See TerminateJob for more information on using the TerminateJob API call, and error handling.

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 TerminateJobRequest method. req, resp := client.TerminateJobRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/TerminateJob

TerminateJobWithContext

func (c *Batch) TerminateJobWithContext(ctx aws.Context, input *TerminateJobInput, opts ...request.Option) (*TerminateJobOutput, error)

TerminateJobWithContext is the same as TerminateJob with the addition of the ability to pass a context and additional request options.

See TerminateJob for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

UpdateComputeEnvironment

func (c *Batch) UpdateComputeEnvironment(input *UpdateComputeEnvironmentInput) (*UpdateComputeEnvironmentOutput, error)

UpdateComputeEnvironment API operation for AWS Batch.

Updates an AWS Batch compute environment.

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 the error.

See the AWS API reference guide for AWS Batch's API operation UpdateComputeEnvironment for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/UpdateComputeEnvironment

Example

Batch UpdateComputeEnvironment shared00

To update a compute environment

This example disables the P2OnDemand compute environment so it can be deleted.

{ svc := batch.New(session.New()) input := &batch.UpdateComputeEnvironmentInput{ ComputeEnvironment: aws.String("P2OnDemand"), State: aws.String("DISABLED"), } result, err := svc.UpdateComputeEnvironment(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

UpdateComputeEnvironmentRequest

func (c *Batch) UpdateComputeEnvironmentRequest(input *UpdateComputeEnvironmentInput) (req *request.Request, output *UpdateComputeEnvironmentOutput)

UpdateComputeEnvironmentRequest generates a "aws/request.Request" representing the client's request for the UpdateComputeEnvironment operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See UpdateComputeEnvironment for more information on using the UpdateComputeEnvironment API call, and error handling.

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 UpdateComputeEnvironmentRequest method. req, resp := client.UpdateComputeEnvironmentRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/UpdateComputeEnvironment

UpdateComputeEnvironmentWithContext

func (c *Batch) UpdateComputeEnvironmentWithContext(ctx aws.Context, input *UpdateComputeEnvironmentInput, opts ...request.Option) (*UpdateComputeEnvironmentOutput, error)

UpdateComputeEnvironmentWithContext is the same as UpdateComputeEnvironment with the addition of the ability to pass a context and additional request options.

See UpdateComputeEnvironment for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

UpdateJobQueue

func (c *Batch) UpdateJobQueue(input *UpdateJobQueueInput) (*UpdateJobQueueOutput, error)

UpdateJobQueue API operation for AWS Batch.

Updates a job queue.

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 the error.

See the AWS API reference guide for AWS Batch's API operation UpdateJobQueue for usage and error information.

Returned Error Codes:

  • ErrCodeClientException "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.

  • ErrCodeServerException "ServerException" These errors are usually caused by a server issue.

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/UpdateJobQueue

Example

Batch UpdateJobQueue shared00

To update a job queue

This example disables a job queue so that it can be deleted.

{ svc := batch.New(session.New()) input := &batch.UpdateJobQueueInput{ JobQueue: aws.String("GPGPU"), State: aws.String("DISABLED"), } result, err := svc.UpdateJobQueue(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case batch.ErrCodeClientException: fmt.Println(batch.ErrCodeClientException, aerr.Error()) case batch.ErrCodeServerException: fmt.Println(batch.ErrCodeServerException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

UpdateJobQueueRequest

func (c *Batch) UpdateJobQueueRequest(input *UpdateJobQueueInput) (req *request.Request, output *UpdateJobQueueOutput)

UpdateJobQueueRequest generates a "aws/request.Request" representing the client's request for the UpdateJobQueue operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See UpdateJobQueue for more information on using the UpdateJobQueue API call, and error handling.

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 UpdateJobQueueRequest method. req, resp := client.UpdateJobQueueRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/UpdateJobQueue

UpdateJobQueueWithContext

func (c *Batch) UpdateJobQueueWithContext(ctx aws.Context, input *UpdateJobQueueInput, opts ...request.Option) (*UpdateJobQueueOutput, error)

UpdateJobQueueWithContext is the same as UpdateJobQueue with the addition of the ability to pass a context and additional request options.

See UpdateJobQueue for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

On this page: