@@ -0,0 +1,3214 @@
+//snippet-sourcedescription:%5BArchiveDownload.java demonstrates how to create a job start to retrieve inventory for an Amazon Glacier vault.%5D%0A//snippet-keyword:%5BSDK for Java 2.0%5D%0A//snippet-keyword:%5BCode Sample%5D%0A//snippet-service:%5BAmazon Glacier%5D%0A//snippet-sourcetype:%5Bfull-example%5D%0A//snippet-sourcedate:%5B4/17/2020%5D%0A//snippet-sourceauthor:%5Bscmacdon-aws%5D%0A/*%0A   Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A   This file is licensed under the Apache License, Version 2.0 (the %22License%22).%0A   You may not use this file except in compliance with the License. A copy of%0A   the License is located at%0A    http://aws.amazon.com/apache2.0/%0A   This file is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR%0A   CONDITIONS OF ANY KIND, either express or implied. See the License for the%0A   specific language governing permissions and limitations under the License.%0A*/%0A%0Apackage com.example.glacier;%0A%0A// snippet-start:%5Bglacier.java2.download.import%5D%0Aimport software.amazon.awssdk.regions.Region;%0Aimport software.amazon.awssdk.services.glacier.GlacierClient;%0Aimport software.amazon.awssdk.services.glacier.model.InitiateJobRequest;%0Aimport software.amazon.awssdk.services.glacier.model.JobParameters;%0Aimport software.amazon.awssdk.services.glacier.model.InitiateJobResponse;%0Aimport software.amazon.awssdk.services.glacier.model.GlacierException;%0A// snippet-end:%5Bglacier.java2.download.import%5D%0A%0Apublic class ArchiveDownload %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        final String USAGE = %22%5Cn%22 +%0A                %22ArchiveDownload - start a job to retrieve vault inventory%5Cn%5Cn%22 +%0A                %22Usage: ArchiveDownload %3CvaultName%3E %3CaccountId%3E%5Cn%5Cn%22 +%0A                %22Where:%5Cn%22 +%0A                %22  vaultName - the name of the vault%5Cn%22 +%0A                %22  accountId - the account ID%5Cn%5Cn%22;%0A%0A        if (args.length %3C 2) %7B%0A            System.out.println(USAGE);%0A            System.exit(1);%0A        %7D%0A%0A        String vaultName = args%5B0%5D;%0A        String accountId = args%5B1%5D;%0A%0A        // Create a GlacierClient object%0A        GlacierClient glacier = GlacierClient.builder()%0A                .region(Region.US_EAST_1)%0A                .build();%0A%0A        createJob(glacier, vaultName, accountId) ;%0A    %7D%0A%0A    // snippet-start:%5Bglacier.java2.download.main%5D%0A    public static void createJob(GlacierClient glacier, String vaultName, String accountId) %7B%0A%0A        try %7B%0A%0A            JobParameters job = JobParameters.builder()%0A                    .type(%22inventory-retrieval%22)%0A                    .build();%0A%0A            InitiateJobRequest initJob = InitiateJobRequest.builder()%0A                    .jobParameters(job)%0A                    .accountId(accountId)%0A                    .vaultName(vaultName)%0A                    .build();%0A%0A            InitiateJobResponse response = glacier.initiateJob(initJob);%0A%0A            System.out.println(%22The job ID is: %22 +response.jobId()) ;%0A            System.out.println(%22The relative URI path of the job is: %22 +response.location()) ;%0A%0A        %7D catch(GlacierException e) %7B%0A            System.err.println(e.awsErrorDetails().errorMessage());%0A            System.exit(1);%0A%0A        %7D%0A        System.out.println(%22Done%22);%0A    %7D%0A    // snippet-end:%5Bglacier.java2.download.main%5D%0A%7D%0A

Create ArchiveDownload.java