選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

Use UpdateJobStatus with an AWS SDK or CLI - Amazon Simple Storage Service
此頁面尚未翻譯為您的語言。 請求翻譯

Use UpdateJobStatus with an AWS SDK or CLI

The following code examples show how to use UpdateJobStatus.

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 update the status of an Amazon S3 batch operations job

The following update-job-status example cancels the specified job which is awaiting approval.

aws s3control update-job-status \ --account-id 123456789012 \ --job-id 8d9a18fe-c303-4d39-8ccc-860d372da386 \ --requested-job-status Cancelled

Output:

{ "Status": "Cancelled", "JobId": "8d9a18fe-c303-4d39-8ccc-860d372da386" }

The following update-job-status example confirms and runs the specified which is awaiting approval.

aws s3control update-job-status \ --account-id 123456789012 \ --job-id 5782949f-3301-4fb3-be34-8d5bab54dbca \ --requested-job-status Ready Output:: { "Status": "Ready", "JobId": "5782949f-3301-4fb3-be34-8d5bab54dbca" }

The following update-job-status example cancels the specified job which is running.

aws s3control update-job-status \ --account-id 123456789012 \ --job-id 5782949f-3301-4fb3-be34-8d5bab54dbca \ --requested-job-status Cancelled Output:: { "Status": "Cancelling", "JobId": "5782949f-3301-4fb3-be34-8d5bab54dbca" }
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.

/** * Cancels a job asynchronously. * * @param jobId The ID of the job to be canceled. * @param accountId The ID of the account associated with the job. * @return A {@link CompletableFuture} that completes when the job status has been updated to "CANCELLED". * If an error occurs during the update, the returned future will complete exceptionally. */ public CompletableFuture<Void> cancelJobAsync(String jobId, String accountId) { UpdateJobStatusRequest updateJobStatusRequest = UpdateJobStatusRequest.builder() .accountId(accountId) .jobId(jobId) .requestedJobStatus(String.valueOf(JobStatus.CANCELLED)) .build(); return asyncClient.updateJobStatus(updateJobStatusRequest) .thenAccept(updateJobStatusResponse -> { System.out.println("Job status updated to: " + updateJobStatusResponse.status()); }) .exceptionally(ex -> { System.err.println("Failed to cancel job: " + ex.getMessage()); throw new RuntimeException(ex); // Propagate the exception }); }
  • For API details, see UpdateJobStatus in AWS SDK for Java 2.x API Reference.

AWS CLI

To update the status of an Amazon S3 batch operations job

The following update-job-status example cancels the specified job which is awaiting approval.

aws s3control update-job-status \ --account-id 123456789012 \ --job-id 8d9a18fe-c303-4d39-8ccc-860d372da386 \ --requested-job-status Cancelled

Output:

{ "Status": "Cancelled", "JobId": "8d9a18fe-c303-4d39-8ccc-860d372da386" }

The following update-job-status example confirms and runs the specified which is awaiting approval.

aws s3control update-job-status \ --account-id 123456789012 \ --job-id 5782949f-3301-4fb3-be34-8d5bab54dbca \ --requested-job-status Ready Output:: { "Status": "Ready", "JobId": "5782949f-3301-4fb3-be34-8d5bab54dbca" }

The following update-job-status example cancels the specified job which is running.

aws s3control update-job-status \ --account-id 123456789012 \ --job-id 5782949f-3301-4fb3-be34-8d5bab54dbca \ --requested-job-status Cancelled Output:: { "Status": "Cancelling", "JobId": "5782949f-3301-4fb3-be34-8d5bab54dbca" }

For a complete list of AWS SDK developer guides and code examples, see Developing with Amazon S3 using the AWS SDKs. This topic also includes information about getting started and details about previous SDK versions.

隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。