Use DeregisterJobDefinition with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DeregisterJobDefinition with an AWS SDK or CLI

The following code examples show how to use DeregisterJobDefinition.

Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example:

CLI
AWS CLI

To deregister a job definition

This example deregisters a job definition called sleep10.

Command:

aws batch deregister-job-definition --job-definition sleep10
Java
SDK for Java 2.x
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

/** * Deregisters a job definition asynchronously. * * @param jobDefinition the name of the job definition to be deregistered * @return a CompletableFuture that completes when the job definition has been deregistered * or an exception has occurred */ public CompletableFuture<DeregisterJobDefinitionResponse> deregisterJobDefinitionAsync(String jobDefinition) { DeregisterJobDefinitionRequest jobDefinitionRequest = DeregisterJobDefinitionRequest.builder() .jobDefinition(jobDefinition) .build(); CompletableFuture<DeregisterJobDefinitionResponse> responseFuture = getAsyncClient().deregisterJobDefinition(jobDefinitionRequest); responseFuture.whenComplete((response, ex) -> { if (ex != null) { throw new RuntimeException("Unexpected error occurred: " + ex.getMessage(), ex); } }); return responseFuture; }