@@ -0,0 +1,3529 @@
+//snippet-sourcedescription:%5BCreateContainer.java demonstrates how to create an AWS Elemental MediaStore container.%5D%0A//snippet-keyword:%5BJava%5D%0A//snippet-keyword:%5BCode Sample%5D%0A//snippet-keyword:%5BAWS Elemental MediaStore%5D%0A//snippet-service:%5BAWS Elemental MediaStore%5D%0A//snippet-sourcetype:%5Bfull-example%5D%0A//snippet-sourcedate:%5B9/1/2020%5D%0A//snippet-sourceauthor:%5Bscmacdon AWS%5D%0A/*%0A * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22).%0A * You may not use this file except in compliance with the License.%0A * A copy of the License is located at%0A *%0A *  http://aws.amazon.com/apache2.0%0A *%0A * or in the %22license%22 file accompanying this file. This file is distributed%0A * on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either%0A * express or implied. See the License for the specific language governing%0A * permissions and limitations under the License.%0A */%0A%0Apackage com.example.mediastore;%0A%0A//snippet-start:%5Bmediastore.java2.create_container.import%5D%0Aimport software.amazon.awssdk.services.mediastore.MediaStoreClient;%0Aimport software.amazon.awssdk.regions.Region;%0Aimport software.amazon.awssdk.services.mediastore.model.CreateContainerRequest;%0Aimport software.amazon.awssdk.services.mediastore.model.CreateContainerResponse;%0Aimport software.amazon.awssdk.services.mediastore.model.MediaStoreException;%0A//snippet-end:%5Bmediastore.java2.create_container.import%5D%0A%0Apublic class CreateContainer %7B%0A%0A    public static long sleepTime = 10;%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        final String USAGE = %22%5Cn%22 +%0A                %22CreateContainer - create an AWS Elemental MediaStore container%5Cn%5Cn%22 +%0A                %22Usage: CreateContainer %3CcontainerName%3E%5Cn%5Cn%22 +%0A                %22Where:%5Cn%22 +%0A                %22  containerName - the name of the container to create.%5Cn%22;%0A%0A         if (args.length %3C 1) %7B%0A            System.out.println(USAGE);%0A             System.exit(1);%0A        %7D%0A%0A        /* Read the name from command args */%0A        final String containerName = args%5B0%5D;%0A%0A        Region region = Region.US_EAST_1;%0A        MediaStoreClient mediaStoreClient = MediaStoreClient.builder()%0A                .region(region)%0A                .build();%0A%0A        createMediaContainer(mediaStoreClient, containerName);%0A    %7D%0A%0A    //snippet-start:%5Bmediastore.java2.create_container.main%5D%0A    public static void createMediaContainer( MediaStoreClient mediaStoreClient, String containerName) %7B%0A%0A        try %7B%0A            CreateContainerRequest containerRequest = CreateContainerRequest.builder()%0A                .containerName(containerName)%0A                .build();%0A%0A            CreateContainerResponse containerResponse = mediaStoreClient.createContainer(containerRequest);%0A            String status = containerResponse.container().status().toString();%0A%0A            // Wait unitl the container is in an active state%0A            while (!status.equalsIgnoreCase(%22Active%22))%7B%0A                status = DescribeContainer.checkContainer(mediaStoreClient, containerName);%0A                System.out.println(%22Status - %22+ status);%0A                Thread.sleep(sleepTime * 1000);%0A                %7D%0A%0A            System.out.println(%22The container ARN value is %22+containerResponse.container().arn());%0A            System.out.println(%22Finished %22);%0A%0A        %7D catch (MediaStoreException %7C InterruptedException e) %7B%0A            System.err.println(e.getMessage());%0A            System.exit(1);%0A        %7D%0A    %7D%0A    //snippet-end:%5Bmediastore.java2.create_container.main%5D%0A%7D%0A

Create CreateContainer.java