UpdateJobStatus.java - AWS Code Sample


UpdateJobStatus.java demonstrates how to make job eligible for execution.

/** * Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * <p> * This file is licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. A copy of * the License is located at * <p> * http://aws.amazon.com/apache2.0/ * <p> * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package aws.example.s3control; import com.amazonaws.AmazonServiceException; import com.amazonaws.SdkClientException; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.services.s3control.AWSS3Control; import com.amazonaws.services.s3control.AWSS3ControlClient; import com.amazonaws.services.s3control.model.UpdateJobStatusRequest; import static com.amazonaws.regions.Regions.US_WEST_2; public class UpdateJobStatus { public static void main(String[] args) { String accountId = "Account ID"; String jobId = "00e123a4-c0d8-41f4-a0eb-b46f9ba5b07c"; try { AWSS3Control s3ControlClient = AWSS3ControlClient.builder() .withCredentials(new ProfileCredentialsProvider()) .withRegion(US_WEST_2) .build(); s3ControlClient.updateJobStatus(new UpdateJobStatusRequest() .withAccountId(accountId) .withJobId(jobId) .withRequestedJobStatus("Ready")); } catch (AmazonServiceException e) { // The call was transmitted successfully, but Amazon S3 couldn't process // it and returned an error response. e.printStackTrace(); } catch (SdkClientException e) { // Amazon S3 couldn't be contacted for a response, or the client // couldn't parse the response from Amazon S3. e.printStackTrace(); } } }

Sample Details

Service: s3

Last tested: 2019-04-30

Author: jschwarzwalder (AWS)

Type: full-example