AWS SDK または CLI で UpdateJobPriority を使用する - AWS SDK コードサンプル

AWS Doc SDK Examples GitHub リポジトリには、他にも用意されている AWS SDK サンプルがあります。

AWS SDK または CLI で UpdateJobPriority を使用する

次のサンプルコードは、UpdateJobPriority を使用する方法を説明しています。

アクション例は、より大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。次のコード例で、このアクションのコンテキストを確認できます。

CLI
AWS CLI

Amazon S3 バッチオペレーションジョブのジョブ優先度を更新するには

次の update-job-priority の例では、指定されたジョブを新しい優先度に更新します。

aws s3control update-job-priority \ --account-id 123456789012 \ --job-id 8d9a18fe-c303-4d39-8ccc-860d372da386 \ --priority 52

出力:

{ "JobId": "8d9a18fe-c303-4d39-8ccc-860d372da386", "Priority": 52 }
  • API の詳細については、「AWS CLI コマンドリファレンス」の「UpdateJobPriority」を参照してください。

Java
SDK for Java 2.x
注記

GitHub には、その他のリソースもあります。AWS コード例リポジトリで完全な例を見つけて、設定と実行の方法を確認してください。

/** * Updates the priority of a job asynchronously. * * @param jobId the ID of the job to update * @param accountId the ID of the account associated with the job * @return a {@link CompletableFuture} that represents the asynchronous operation, which completes when the job priority has been updated or an error has occurred */ public CompletableFuture<Void> updateJobPriorityAsync(String jobId, String accountId) { UpdateJobPriorityRequest priorityRequest = UpdateJobPriorityRequest.builder() .accountId(accountId) .jobId(jobId) .priority(60) .build(); CompletableFuture<Void> future = new CompletableFuture<>(); getAsyncClient().updateJobPriority(priorityRequest) .thenAccept(response -> { System.out.println("The job priority was updated"); future.complete(null); // Complete the CompletableFuture on successful execution }) .exceptionally(ex -> { System.err.println("Failed to update job priority: " + ex.getMessage()); future.completeExceptionally(ex); // Complete the CompletableFuture exceptionally on error return null; // Return null to handle the exception }); return future; }
  • API の詳細については、「AWS SDK for Java 2.x API リファレンス」の「UpdateJobPriority」を参照してください。