- AWS Code Sample demonstrates how to create an AWS Elemental MediaStore container.

/* Copyright 2010-2019, Inc. or its affiliates. All Rights Reserved. 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 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.mediastore; import; import; import; import; import; import; /** * Create an AWS Elemental MediaStore container. * * This code expects that you have AWS credentials set up per: * */ public class CreateContainer { public static void main(String[] args) { final String USAGE = "\n" + "CreateContainer - create an AWS Elemental MediaStore container\n\n" + "Usage: CreateContainer <name>\n\n" + "Where:\n" + " name - the name of the container to create.\n"; if (args.length < 1) { System.out.println(USAGE); System.exit(1); } final String name = args[0]; System.out.format("\nCreating MediaStore container: %s\n", name); final Container c = createContainer(name); if (c == null) { System.out.println("Error creating container!\n"); } else { System.out.println("Done!\n"); } } public static Container createContainer(String name) { final AWSMediaStore mediastore = AWSMediaStoreClientBuilder.defaultClient(); final CreateContainerRequest request = new CreateContainerRequest() .withContainerName(name.trim()); try { final CreateContainerResult result = mediastore.createContainer(request); return result.getContainer(); } catch (AWSMediaStoreException e) { System.err.println(e.getErrorMessage()); } return null; } }

Sample Details

Service: mediastore

Last tested: 2018-11-06

Author: rhcarvalho

Type: full-example