Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 AWS
翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
AWS SDK または CLI DeregisterJobDefinitionで を使用する
次のサンプルコードは、DeregisterJobDefinition を使用する方法を説明しています。
アクション例は、より大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。次のコード例で、このアクションのコンテキストを確認できます。
- CLI
-
- AWS CLI
-
タスク定義を登録解除する方法
この例では、 sleep10 というジョブ定義を登録解除します。
コマンド:
aws batch deregister-job-definition --job-definition sleep10
- Java
-
- SDK for Java 2.x
-
GitHub には、その他のリソースもあります。AWS コード例リポジトリ で全く同じ例を見つけて、設定と実行の方法を確認してください。
/**
* 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;
}