/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::DynamoDB::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; CreateTableRequest::CreateTableRequest() : m_attributeDefinitionsHasBeenSet(false), m_tableNameHasBeenSet(false), m_keySchemaHasBeenSet(false), m_localSecondaryIndexesHasBeenSet(false), m_globalSecondaryIndexesHasBeenSet(false), m_billingMode(BillingMode::NOT_SET), m_billingModeHasBeenSet(false), m_provisionedThroughputHasBeenSet(false), m_streamSpecificationHasBeenSet(false), m_sSESpecificationHasBeenSet(false), m_tagsHasBeenSet(false), m_tableClass(TableClass::NOT_SET), m_tableClassHasBeenSet(false), m_deletionProtectionEnabled(false), m_deletionProtectionEnabledHasBeenSet(false) { } Aws::String CreateTableRequest::SerializePayload() const { JsonValue payload; if(m_attributeDefinitionsHasBeenSet) { Aws::Utils::Array attributeDefinitionsJsonList(m_attributeDefinitions.size()); for(unsigned attributeDefinitionsIndex = 0; attributeDefinitionsIndex < attributeDefinitionsJsonList.GetLength(); ++attributeDefinitionsIndex) { attributeDefinitionsJsonList[attributeDefinitionsIndex].AsObject(m_attributeDefinitions[attributeDefinitionsIndex].Jsonize()); } payload.WithArray("AttributeDefinitions", std::move(attributeDefinitionsJsonList)); } if(m_tableNameHasBeenSet) { payload.WithString("TableName", m_tableName); } if(m_keySchemaHasBeenSet) { Aws::Utils::Array keySchemaJsonList(m_keySchema.size()); for(unsigned keySchemaIndex = 0; keySchemaIndex < keySchemaJsonList.GetLength(); ++keySchemaIndex) { keySchemaJsonList[keySchemaIndex].AsObject(m_keySchema[keySchemaIndex].Jsonize()); } payload.WithArray("KeySchema", std::move(keySchemaJsonList)); } if(m_localSecondaryIndexesHasBeenSet) { Aws::Utils::Array localSecondaryIndexesJsonList(m_localSecondaryIndexes.size()); for(unsigned localSecondaryIndexesIndex = 0; localSecondaryIndexesIndex < localSecondaryIndexesJsonList.GetLength(); ++localSecondaryIndexesIndex) { localSecondaryIndexesJsonList[localSecondaryIndexesIndex].AsObject(m_localSecondaryIndexes[localSecondaryIndexesIndex].Jsonize()); } payload.WithArray("LocalSecondaryIndexes", std::move(localSecondaryIndexesJsonList)); } if(m_globalSecondaryIndexesHasBeenSet) { Aws::Utils::Array globalSecondaryIndexesJsonList(m_globalSecondaryIndexes.size()); for(unsigned globalSecondaryIndexesIndex = 0; globalSecondaryIndexesIndex < globalSecondaryIndexesJsonList.GetLength(); ++globalSecondaryIndexesIndex) { globalSecondaryIndexesJsonList[globalSecondaryIndexesIndex].AsObject(m_globalSecondaryIndexes[globalSecondaryIndexesIndex].Jsonize()); } payload.WithArray("GlobalSecondaryIndexes", std::move(globalSecondaryIndexesJsonList)); } if(m_billingModeHasBeenSet) { payload.WithString("BillingMode", BillingModeMapper::GetNameForBillingMode(m_billingMode)); } if(m_provisionedThroughputHasBeenSet) { payload.WithObject("ProvisionedThroughput", m_provisionedThroughput.Jsonize()); } if(m_streamSpecificationHasBeenSet) { payload.WithObject("StreamSpecification", m_streamSpecification.Jsonize()); } if(m_sSESpecificationHasBeenSet) { payload.WithObject("SSESpecification", m_sSESpecification.Jsonize()); } if(m_tagsHasBeenSet) { Aws::Utils::Array tagsJsonList(m_tags.size()); for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex) { tagsJsonList[tagsIndex].AsObject(m_tags[tagsIndex].Jsonize()); } payload.WithArray("Tags", std::move(tagsJsonList)); } if(m_tableClassHasBeenSet) { payload.WithString("TableClass", TableClassMapper::GetNameForTableClass(m_tableClass)); } if(m_deletionProtectionEnabledHasBeenSet) { payload.WithBool("DeletionProtectionEnabled", m_deletionProtectionEnabled); } return payload.View().WriteReadable(); } Aws::Http::HeaderValueCollection CreateTableRequest::GetRequestSpecificHeaders() const { Aws::Http::HeaderValueCollection headers; headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "DynamoDB_20120810.CreateTable")); return headers; }