/* * Copyright 2014-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * 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 * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. 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 com.amazonaws.services.dynamodbv2.document; import java.util.List; import java.util.Map; import com.amazonaws.annotation.ThreadSafe; import com.amazonaws.regions.Regions; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient; import com.amazonaws.services.dynamodbv2.document.api.BatchGetItemApi; import com.amazonaws.services.dynamodbv2.document.api.BatchWriteItemApi; import com.amazonaws.services.dynamodbv2.document.api.ListTablesApi; import com.amazonaws.services.dynamodbv2.document.internal.BatchGetItemImpl; import com.amazonaws.services.dynamodbv2.document.internal.BatchWriteItemImpl; import com.amazonaws.services.dynamodbv2.document.internal.ListTablesImpl; import com.amazonaws.services.dynamodbv2.document.spec.BatchGetItemSpec; import com.amazonaws.services.dynamodbv2.document.spec.BatchWriteItemSpec; import com.amazonaws.services.dynamodbv2.document.spec.ListTablesSpec; import com.amazonaws.services.dynamodbv2.model.AttributeDefinition; import com.amazonaws.services.dynamodbv2.model.CreateTableRequest; import com.amazonaws.services.dynamodbv2.model.CreateTableResult; import com.amazonaws.services.dynamodbv2.model.KeySchemaElement; import com.amazonaws.services.dynamodbv2.model.KeysAndAttributes; import com.amazonaws.services.dynamodbv2.model.ListTablesResult; import com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput; import com.amazonaws.services.dynamodbv2.model.ReturnConsumedCapacity; import com.amazonaws.services.dynamodbv2.model.WriteRequest; /** * DynamoDB Document API. This class is the entry point to make use of this * library. */ @ThreadSafe public class DynamoDB implements ListTablesApi, BatchGetItemApi, BatchWriteItemApi { private final AmazonDynamoDB client; private final ListTablesImpl listTablesDelegate; private final BatchGetItemImpl batchGetItemDelegate; private final BatchWriteItemImpl batchWriteItemDelegate; public DynamoDB(AmazonDynamoDB client) { if (client == null) { throw new IllegalArgumentException(); } this.client = client; this.listTablesDelegate = new ListTablesImpl(client); this.batchGetItemDelegate = new BatchGetItemImpl(client); this.batchWriteItemDelegate = new BatchWriteItemImpl(client); } /** * Create a DynamoDB object that talks to the specified AWS region. The * underlying service client will use all the default client configurations, * including the default credentials provider chain. See * {@link AmazonDynamoDBClient#AmazonDynamoDBClient()} for more information. *
* If you need more control over the client configuration, use
* {@link DynamoDB#DynamoDB(AmazonDynamoDB)} instead.
*
* @param regionEnum
* the AWS region enum
* @see AmazonDynamoDBClient#AmazonDynamoDBClient()
*/
public DynamoDB(Regions regionEnum) {
this(new AmazonDynamoDBClient()
.