UNPKG

@aws-cdk/aws-dynamodb

Version:

The CDK Construct Library for AWS::DynamoDB

861 lines 560 kB
"use strict"; var _a, _b; Object.defineProperty(exports, "__esModule", { value: true }); exports.CfnTable = exports.CfnGlobalTable = void 0; const jsiiDeprecationWarnings = require("../.warnings.jsii.js"); const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti"); // Copyright 2012-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. // Generated from the AWS CloudFormation Resource Specification // See: docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html // @cfn2ts:meta@ {"generated":"2023-06-19T15:18:57.211Z","fingerprint":"/XZ1AzfkW8dW7rShEDAuM9QOCAYZ+SX0zuY5lWuLueY="} /* eslint-disable max-len */ // This is generated code - line lengths are difficult to control const cdk = require("@aws-cdk/core"); const cfn_parse = require("@aws-cdk/core/lib/helpers-internal"); /** * Determine whether the given properties match those of a `CfnGlobalTableProps` * * @param properties - the TypeScript properties of a `CfnGlobalTableProps` * * @returns the result of the validation. */ function CfnGlobalTablePropsValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('attributeDefinitions', cdk.requiredValidator)(properties.attributeDefinitions)); errors.collect(cdk.propertyValidator('attributeDefinitions', cdk.listValidator(CfnGlobalTable_AttributeDefinitionPropertyValidator))(properties.attributeDefinitions)); errors.collect(cdk.propertyValidator('billingMode', cdk.validateString)(properties.billingMode)); errors.collect(cdk.propertyValidator('globalSecondaryIndexes', cdk.listValidator(CfnGlobalTable_GlobalSecondaryIndexPropertyValidator))(properties.globalSecondaryIndexes)); errors.collect(cdk.propertyValidator('keySchema', cdk.requiredValidator)(properties.keySchema)); errors.collect(cdk.propertyValidator('keySchema', cdk.listValidator(CfnGlobalTable_KeySchemaPropertyValidator))(properties.keySchema)); errors.collect(cdk.propertyValidator('localSecondaryIndexes', cdk.listValidator(CfnGlobalTable_LocalSecondaryIndexPropertyValidator))(properties.localSecondaryIndexes)); errors.collect(cdk.propertyValidator('replicas', cdk.requiredValidator)(properties.replicas)); errors.collect(cdk.propertyValidator('replicas', cdk.listValidator(CfnGlobalTable_ReplicaSpecificationPropertyValidator))(properties.replicas)); errors.collect(cdk.propertyValidator('sseSpecification', CfnGlobalTable_SSESpecificationPropertyValidator)(properties.sseSpecification)); errors.collect(cdk.propertyValidator('streamSpecification', CfnGlobalTable_StreamSpecificationPropertyValidator)(properties.streamSpecification)); errors.collect(cdk.propertyValidator('tableName', cdk.validateString)(properties.tableName)); errors.collect(cdk.propertyValidator('timeToLiveSpecification', CfnGlobalTable_TimeToLiveSpecificationPropertyValidator)(properties.timeToLiveSpecification)); errors.collect(cdk.propertyValidator('writeProvisionedThroughputSettings', CfnGlobalTable_WriteProvisionedThroughputSettingsPropertyValidator)(properties.writeProvisionedThroughputSettings)); return errors.wrap('supplied properties not correct for "CfnGlobalTableProps"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable` resource * * @param properties - the TypeScript properties of a `CfnGlobalTableProps` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable` resource. */ // @ts-ignore TS6133 function cfnGlobalTablePropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTablePropsValidator(properties).assertSuccess(); return { AttributeDefinitions: cdk.listMapper(cfnGlobalTableAttributeDefinitionPropertyToCloudFormation)(properties.attributeDefinitions), KeySchema: cdk.listMapper(cfnGlobalTableKeySchemaPropertyToCloudFormation)(properties.keySchema), Replicas: cdk.listMapper(cfnGlobalTableReplicaSpecificationPropertyToCloudFormation)(properties.replicas), BillingMode: cdk.stringToCloudFormation(properties.billingMode), GlobalSecondaryIndexes: cdk.listMapper(cfnGlobalTableGlobalSecondaryIndexPropertyToCloudFormation)(properties.globalSecondaryIndexes), LocalSecondaryIndexes: cdk.listMapper(cfnGlobalTableLocalSecondaryIndexPropertyToCloudFormation)(properties.localSecondaryIndexes), SSESpecification: cfnGlobalTableSSESpecificationPropertyToCloudFormation(properties.sseSpecification), StreamSpecification: cfnGlobalTableStreamSpecificationPropertyToCloudFormation(properties.streamSpecification), TableName: cdk.stringToCloudFormation(properties.tableName), TimeToLiveSpecification: cfnGlobalTableTimeToLiveSpecificationPropertyToCloudFormation(properties.timeToLiveSpecification), WriteProvisionedThroughputSettings: cfnGlobalTableWriteProvisionedThroughputSettingsPropertyToCloudFormation(properties.writeProvisionedThroughputSettings), }; } // @ts-ignore TS6133 function CfnGlobalTablePropsFromCloudFormation(properties) { properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('attributeDefinitions', 'AttributeDefinitions', cfn_parse.FromCloudFormation.getArray(CfnGlobalTableAttributeDefinitionPropertyFromCloudFormation)(properties.AttributeDefinitions)); ret.addPropertyResult('keySchema', 'KeySchema', cfn_parse.FromCloudFormation.getArray(CfnGlobalTableKeySchemaPropertyFromCloudFormation)(properties.KeySchema)); ret.addPropertyResult('replicas', 'Replicas', cfn_parse.FromCloudFormation.getArray(CfnGlobalTableReplicaSpecificationPropertyFromCloudFormation)(properties.Replicas)); ret.addPropertyResult('billingMode', 'BillingMode', properties.BillingMode != null ? cfn_parse.FromCloudFormation.getString(properties.BillingMode) : undefined); ret.addPropertyResult('globalSecondaryIndexes', 'GlobalSecondaryIndexes', properties.GlobalSecondaryIndexes != null ? cfn_parse.FromCloudFormation.getArray(CfnGlobalTableGlobalSecondaryIndexPropertyFromCloudFormation)(properties.GlobalSecondaryIndexes) : undefined); ret.addPropertyResult('localSecondaryIndexes', 'LocalSecondaryIndexes', properties.LocalSecondaryIndexes != null ? cfn_parse.FromCloudFormation.getArray(CfnGlobalTableLocalSecondaryIndexPropertyFromCloudFormation)(properties.LocalSecondaryIndexes) : undefined); ret.addPropertyResult('sseSpecification', 'SSESpecification', properties.SSESpecification != null ? CfnGlobalTableSSESpecificationPropertyFromCloudFormation(properties.SSESpecification) : undefined); ret.addPropertyResult('streamSpecification', 'StreamSpecification', properties.StreamSpecification != null ? CfnGlobalTableStreamSpecificationPropertyFromCloudFormation(properties.StreamSpecification) : undefined); ret.addPropertyResult('tableName', 'TableName', properties.TableName != null ? cfn_parse.FromCloudFormation.getString(properties.TableName) : undefined); ret.addPropertyResult('timeToLiveSpecification', 'TimeToLiveSpecification', properties.TimeToLiveSpecification != null ? CfnGlobalTableTimeToLiveSpecificationPropertyFromCloudFormation(properties.TimeToLiveSpecification) : undefined); ret.addPropertyResult('writeProvisionedThroughputSettings', 'WriteProvisionedThroughputSettings', properties.WriteProvisionedThroughputSettings != null ? CfnGlobalTableWriteProvisionedThroughputSettingsPropertyFromCloudFormation(properties.WriteProvisionedThroughputSettings) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * A CloudFormation `AWS::DynamoDB::GlobalTable` * * The `AWS::DynamoDB::GlobalTable` resource enables you to create and manage a Version 2019.11.21 global table. This resource cannot be used to create or manage a Version 2017.11.29 global table. For more information, see [Global tables](https://docs.aws.amazon.com//amazondynamodb/latest/developerguide/GlobalTables.html) . * * > You cannot convert a resource of type `AWS::DynamoDB::Table` into a resource of type `AWS::DynamoDB::GlobalTable` by changing its type in your template. *Doing so might result in the deletion of your DynamoDB table.* * > * > You can instead use the GlobalTable resource to create a new table in a single Region. This will be billed the same as a single Region table. If you later update the stack to add other Regions then Global Tables pricing will apply. * * You should be aware of the following behaviors when working with DynamoDB global tables. * * - The IAM Principal executing the stack operation must have the permissions listed below in all regions where you plan to have a global table replica. The IAM Principal's permissions should not have restrictions based on IP source address. Some global tables operations (for example, adding a replica) are asynchronous, and require that the IAM Principal is valid until they complete. You should not delete the Principal (user or IAM role) until CloudFormation has finished updating your stack. * * - `dynamodb:CreateTable` * - `dynamodb:UpdateTable` * - `dynamodb:DeleteTable` * - `dynamodb:DescribeContinuousBackups` * - `dynamodb:DescribeContributorInsights` * - `dynamodb:DescribeTable` * - `dynamodb:DescribeTableReplicaAutoScaling` * - `dynamodb:DescribeTimeToLive` * - `dynamodb:ListTables` * - `dynamodb:UpdateTimeToLive` * - `dynamodb:UpdateContributorInsights` * - `dynamodb:UpdateContinuousBackups` * - `dynamodb:ListTagsOfResource` * - `dynamodb:TableClass` * - `dynamodb:TagResource` * - `dynamodb:UntagResource` * - `dynamodb:BatchWriteItem` * - `dynamodb:CreateTableReplica` * - `dynamodb:DeleteItem` * - `dynamodb:DeleteTableReplica` * - `dynamodb:DisableKinesisStreamingDestination` * - `dynamodb:EnableKinesisStreamingDestination` * - `dynamodb:GetItem` * - `dynamodb:PutItem` * - `dynamodb:Query` * - `dynamodb:Scan` * - `dynamodb:UpdateItem` * - `dynamodb:DescribeTableReplicaAutoScaling` * - `dynamodb:UpdateTableReplicaAutoScaling` * - `iam:CreateServiceLinkedRole` * - `kms:CreateGrant` * - `kms:DescribeKey` * - `application-autoscaling:DeleteScalingPolicy` * - `application-autoscaling:DeleteScheduledAction` * - `application-autoscaling:DeregisterScalableTarget` * - `application-autoscaling:DescribeScalingPolicies` * - `application-autoscaling:DescribeScalableTargets` * - `application-autoscaling:PutScalingPolicy` * - `application-autoscaling:PutScheduledAction` * - `application-autoscaling:RegisterScalableTarget` * - When using provisioned billing mode, CloudFormation will create an auto scaling policy on each of your replicas to control their write capacities. You must configure this policy using the `WriteProvisionedThroughputSettings` property. CloudFormation will ensure that all replicas have the same write capacity auto scaling property. You cannot directly specify a value for write capacity for a global table. * - If your table uses provisioned capacity, you must configure auto scaling directly in the `AWS::DynamoDB::GlobalTable` resource. You should not configure additional auto scaling policies on any of the table replicas or global secondary indexes, either via API or via `AWS::ApplicationAutoScaling::ScalableTarget` or `AWS::ApplicationAutoScaling::ScalingPolicy` . Doing so might result in unexpected behavior and is unsupported. * - In AWS CloudFormation , each global table is controlled by a single stack, in a single region, regardless of the number of replicas. When you deploy your template, CloudFormation will create/update all replicas as part of a single stack operation. You should not deploy the same `AWS::DynamoDB::GlobalTable` resource in multiple regions. Doing so will result in errors, and is unsupported. If you deploy your application template in multiple regions, you can use conditions to only create the resource in a single region. Alternatively, you can choose to define your `AWS::DynamoDB::GlobalTable` resources in a stack separate from your application stack, and make sure it is only deployed to a single region. * * @cloudformationResource AWS::DynamoDB::GlobalTable * @stability external * * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-globaltable.html */ class CfnGlobalTable extends cdk.CfnResource { /** * Create a new `AWS::DynamoDB::GlobalTable`. * * @param scope - scope in which this resource is defined * @param id - scoped id of the resource * @param props - resource properties */ constructor(scope, id, props) { super(scope, id, { type: CfnGlobalTable.CFN_RESOURCE_TYPE_NAME, properties: props }); try { jsiiDeprecationWarnings._aws_cdk_aws_dynamodb_CfnGlobalTableProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, CfnGlobalTable); } throw error; } cdk.requireProperty(props, 'attributeDefinitions', this); cdk.requireProperty(props, 'keySchema', this); cdk.requireProperty(props, 'replicas', this); this.attrArn = cdk.Token.asString(this.getAtt('Arn')); this.attrStreamArn = cdk.Token.asString(this.getAtt('StreamArn')); this.attrTableId = cdk.Token.asString(this.getAtt('TableId')); this.attributeDefinitions = props.attributeDefinitions; this.keySchema = props.keySchema; this.replicas = props.replicas; this.billingMode = props.billingMode; this.globalSecondaryIndexes = props.globalSecondaryIndexes; this.localSecondaryIndexes = props.localSecondaryIndexes; this.sseSpecification = props.sseSpecification; this.streamSpecification = props.streamSpecification; this.tableName = props.tableName; this.timeToLiveSpecification = props.timeToLiveSpecification; this.writeProvisionedThroughputSettings = props.writeProvisionedThroughputSettings; if (this.node.scope && cdk.Resource.isResource(this.node.scope)) { this.node.addValidation({ validate: () => this.cfnOptions.deletionPolicy === undefined ? ['\'AWS::DynamoDB::GlobalTable\' is a stateful resource type, and you must specify a Removal Policy for it. Call \'resource.applyRemovalPolicy()\'.'] : [] }); } } /** * A factory method that creates a new instance of this class from an object * containing the CloudFormation properties of this resource. * Used in the @aws-cdk/cloudformation-include module. * * @internal */ static _fromCloudFormation(scope, id, resourceAttributes, options) { resourceAttributes = resourceAttributes || {}; const resourceProperties = options.parser.parseValue(resourceAttributes.Properties); const propsResult = CfnGlobalTablePropsFromCloudFormation(resourceProperties); const ret = new CfnGlobalTable(scope, id, propsResult.value); for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) { ret.addPropertyOverride(propKey, propVal); } options.parser.handleAttributes(ret, resourceAttributes, id); return ret; } /** * Examines the CloudFormation resource and discloses attributes. * * @param inspector - tree inspector to collect and process attributes * */ inspect(inspector) { inspector.addAttribute("aws:cdk:cloudformation:type", CfnGlobalTable.CFN_RESOURCE_TYPE_NAME); inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties); } get cfnProperties() { return { attributeDefinitions: this.attributeDefinitions, keySchema: this.keySchema, replicas: this.replicas, billingMode: this.billingMode, globalSecondaryIndexes: this.globalSecondaryIndexes, localSecondaryIndexes: this.localSecondaryIndexes, sseSpecification: this.sseSpecification, streamSpecification: this.streamSpecification, tableName: this.tableName, timeToLiveSpecification: this.timeToLiveSpecification, writeProvisionedThroughputSettings: this.writeProvisionedThroughputSettings, }; } renderProperties(props) { return cfnGlobalTablePropsToCloudFormation(props); } } exports.CfnGlobalTable = CfnGlobalTable; _a = JSII_RTTI_SYMBOL_1; CfnGlobalTable[_a] = { fqn: "@aws-cdk/aws-dynamodb.CfnGlobalTable", version: "1.204.0" }; /** * The CloudFormation resource type name for this resource class. */ CfnGlobalTable.CFN_RESOURCE_TYPE_NAME = "AWS::DynamoDB::GlobalTable"; /** * Determine whether the given properties match those of a `AttributeDefinitionProperty` * * @param properties - the TypeScript properties of a `AttributeDefinitionProperty` * * @returns the result of the validation. */ function CfnGlobalTable_AttributeDefinitionPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('attributeName', cdk.requiredValidator)(properties.attributeName)); errors.collect(cdk.propertyValidator('attributeName', cdk.validateString)(properties.attributeName)); errors.collect(cdk.propertyValidator('attributeType', cdk.requiredValidator)(properties.attributeType)); errors.collect(cdk.propertyValidator('attributeType', cdk.validateString)(properties.attributeType)); return errors.wrap('supplied properties not correct for "AttributeDefinitionProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.AttributeDefinition` resource * * @param properties - the TypeScript properties of a `AttributeDefinitionProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.AttributeDefinition` resource. */ // @ts-ignore TS6133 function cfnGlobalTableAttributeDefinitionPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_AttributeDefinitionPropertyValidator(properties).assertSuccess(); return { AttributeName: cdk.stringToCloudFormation(properties.attributeName), AttributeType: cdk.stringToCloudFormation(properties.attributeType), }; } // @ts-ignore TS6133 function CfnGlobalTableAttributeDefinitionPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('attributeName', 'AttributeName', cfn_parse.FromCloudFormation.getString(properties.AttributeName)); ret.addPropertyResult('attributeType', 'AttributeType', cfn_parse.FromCloudFormation.getString(properties.AttributeType)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `CapacityAutoScalingSettingsProperty` * * @param properties - the TypeScript properties of a `CapacityAutoScalingSettingsProperty` * * @returns the result of the validation. */ function CfnGlobalTable_CapacityAutoScalingSettingsPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('maxCapacity', cdk.requiredValidator)(properties.maxCapacity)); errors.collect(cdk.propertyValidator('maxCapacity', cdk.validateNumber)(properties.maxCapacity)); errors.collect(cdk.propertyValidator('minCapacity', cdk.requiredValidator)(properties.minCapacity)); errors.collect(cdk.propertyValidator('minCapacity', cdk.validateNumber)(properties.minCapacity)); errors.collect(cdk.propertyValidator('seedCapacity', cdk.validateNumber)(properties.seedCapacity)); errors.collect(cdk.propertyValidator('targetTrackingScalingPolicyConfiguration', cdk.requiredValidator)(properties.targetTrackingScalingPolicyConfiguration)); errors.collect(cdk.propertyValidator('targetTrackingScalingPolicyConfiguration', CfnGlobalTable_TargetTrackingScalingPolicyConfigurationPropertyValidator)(properties.targetTrackingScalingPolicyConfiguration)); return errors.wrap('supplied properties not correct for "CapacityAutoScalingSettingsProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.CapacityAutoScalingSettings` resource * * @param properties - the TypeScript properties of a `CapacityAutoScalingSettingsProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.CapacityAutoScalingSettings` resource. */ // @ts-ignore TS6133 function cfnGlobalTableCapacityAutoScalingSettingsPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_CapacityAutoScalingSettingsPropertyValidator(properties).assertSuccess(); return { MaxCapacity: cdk.numberToCloudFormation(properties.maxCapacity), MinCapacity: cdk.numberToCloudFormation(properties.minCapacity), SeedCapacity: cdk.numberToCloudFormation(properties.seedCapacity), TargetTrackingScalingPolicyConfiguration: cfnGlobalTableTargetTrackingScalingPolicyConfigurationPropertyToCloudFormation(properties.targetTrackingScalingPolicyConfiguration), }; } // @ts-ignore TS6133 function CfnGlobalTableCapacityAutoScalingSettingsPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('maxCapacity', 'MaxCapacity', cfn_parse.FromCloudFormation.getNumber(properties.MaxCapacity)); ret.addPropertyResult('minCapacity', 'MinCapacity', cfn_parse.FromCloudFormation.getNumber(properties.MinCapacity)); ret.addPropertyResult('seedCapacity', 'SeedCapacity', properties.SeedCapacity != null ? cfn_parse.FromCloudFormation.getNumber(properties.SeedCapacity) : undefined); ret.addPropertyResult('targetTrackingScalingPolicyConfiguration', 'TargetTrackingScalingPolicyConfiguration', CfnGlobalTableTargetTrackingScalingPolicyConfigurationPropertyFromCloudFormation(properties.TargetTrackingScalingPolicyConfiguration)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ContributorInsightsSpecificationProperty` * * @param properties - the TypeScript properties of a `ContributorInsightsSpecificationProperty` * * @returns the result of the validation. */ function CfnGlobalTable_ContributorInsightsSpecificationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('enabled', cdk.requiredValidator)(properties.enabled)); errors.collect(cdk.propertyValidator('enabled', cdk.validateBoolean)(properties.enabled)); return errors.wrap('supplied properties not correct for "ContributorInsightsSpecificationProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.ContributorInsightsSpecification` resource * * @param properties - the TypeScript properties of a `ContributorInsightsSpecificationProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.ContributorInsightsSpecification` resource. */ // @ts-ignore TS6133 function cfnGlobalTableContributorInsightsSpecificationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_ContributorInsightsSpecificationPropertyValidator(properties).assertSuccess(); return { Enabled: cdk.booleanToCloudFormation(properties.enabled), }; } // @ts-ignore TS6133 function CfnGlobalTableContributorInsightsSpecificationPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('enabled', 'Enabled', cfn_parse.FromCloudFormation.getBoolean(properties.Enabled)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `GlobalSecondaryIndexProperty` * * @param properties - the TypeScript properties of a `GlobalSecondaryIndexProperty` * * @returns the result of the validation. */ function CfnGlobalTable_GlobalSecondaryIndexPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('indexName', cdk.requiredValidator)(properties.indexName)); errors.collect(cdk.propertyValidator('indexName', cdk.validateString)(properties.indexName)); errors.collect(cdk.propertyValidator('keySchema', cdk.requiredValidator)(properties.keySchema)); errors.collect(cdk.propertyValidator('keySchema', cdk.listValidator(CfnGlobalTable_KeySchemaPropertyValidator))(properties.keySchema)); errors.collect(cdk.propertyValidator('projection', cdk.requiredValidator)(properties.projection)); errors.collect(cdk.propertyValidator('projection', CfnGlobalTable_ProjectionPropertyValidator)(properties.projection)); errors.collect(cdk.propertyValidator('writeProvisionedThroughputSettings', CfnGlobalTable_WriteProvisionedThroughputSettingsPropertyValidator)(properties.writeProvisionedThroughputSettings)); return errors.wrap('supplied properties not correct for "GlobalSecondaryIndexProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.GlobalSecondaryIndex` resource * * @param properties - the TypeScript properties of a `GlobalSecondaryIndexProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.GlobalSecondaryIndex` resource. */ // @ts-ignore TS6133 function cfnGlobalTableGlobalSecondaryIndexPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_GlobalSecondaryIndexPropertyValidator(properties).assertSuccess(); return { IndexName: cdk.stringToCloudFormation(properties.indexName), KeySchema: cdk.listMapper(cfnGlobalTableKeySchemaPropertyToCloudFormation)(properties.keySchema), Projection: cfnGlobalTableProjectionPropertyToCloudFormation(properties.projection), WriteProvisionedThroughputSettings: cfnGlobalTableWriteProvisionedThroughputSettingsPropertyToCloudFormation(properties.writeProvisionedThroughputSettings), }; } // @ts-ignore TS6133 function CfnGlobalTableGlobalSecondaryIndexPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('indexName', 'IndexName', cfn_parse.FromCloudFormation.getString(properties.IndexName)); ret.addPropertyResult('keySchema', 'KeySchema', cfn_parse.FromCloudFormation.getArray(CfnGlobalTableKeySchemaPropertyFromCloudFormation)(properties.KeySchema)); ret.addPropertyResult('projection', 'Projection', CfnGlobalTableProjectionPropertyFromCloudFormation(properties.Projection)); ret.addPropertyResult('writeProvisionedThroughputSettings', 'WriteProvisionedThroughputSettings', properties.WriteProvisionedThroughputSettings != null ? CfnGlobalTableWriteProvisionedThroughputSettingsPropertyFromCloudFormation(properties.WriteProvisionedThroughputSettings) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `KeySchemaProperty` * * @param properties - the TypeScript properties of a `KeySchemaProperty` * * @returns the result of the validation. */ function CfnGlobalTable_KeySchemaPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('attributeName', cdk.requiredValidator)(properties.attributeName)); errors.collect(cdk.propertyValidator('attributeName', cdk.validateString)(properties.attributeName)); errors.collect(cdk.propertyValidator('keyType', cdk.requiredValidator)(properties.keyType)); errors.collect(cdk.propertyValidator('keyType', cdk.validateString)(properties.keyType)); return errors.wrap('supplied properties not correct for "KeySchemaProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.KeySchema` resource * * @param properties - the TypeScript properties of a `KeySchemaProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.KeySchema` resource. */ // @ts-ignore TS6133 function cfnGlobalTableKeySchemaPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_KeySchemaPropertyValidator(properties).assertSuccess(); return { AttributeName: cdk.stringToCloudFormation(properties.attributeName), KeyType: cdk.stringToCloudFormation(properties.keyType), }; } // @ts-ignore TS6133 function CfnGlobalTableKeySchemaPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('attributeName', 'AttributeName', cfn_parse.FromCloudFormation.getString(properties.AttributeName)); ret.addPropertyResult('keyType', 'KeyType', cfn_parse.FromCloudFormation.getString(properties.KeyType)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `KinesisStreamSpecificationProperty` * * @param properties - the TypeScript properties of a `KinesisStreamSpecificationProperty` * * @returns the result of the validation. */ function CfnGlobalTable_KinesisStreamSpecificationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('streamArn', cdk.requiredValidator)(properties.streamArn)); errors.collect(cdk.propertyValidator('streamArn', cdk.validateString)(properties.streamArn)); return errors.wrap('supplied properties not correct for "KinesisStreamSpecificationProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.KinesisStreamSpecification` resource * * @param properties - the TypeScript properties of a `KinesisStreamSpecificationProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.KinesisStreamSpecification` resource. */ // @ts-ignore TS6133 function cfnGlobalTableKinesisStreamSpecificationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_KinesisStreamSpecificationPropertyValidator(properties).assertSuccess(); return { StreamArn: cdk.stringToCloudFormation(properties.streamArn), }; } // @ts-ignore TS6133 function CfnGlobalTableKinesisStreamSpecificationPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('streamArn', 'StreamArn', cfn_parse.FromCloudFormation.getString(properties.StreamArn)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `LocalSecondaryIndexProperty` * * @param properties - the TypeScript properties of a `LocalSecondaryIndexProperty` * * @returns the result of the validation. */ function CfnGlobalTable_LocalSecondaryIndexPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('indexName', cdk.requiredValidator)(properties.indexName)); errors.collect(cdk.propertyValidator('indexName', cdk.validateString)(properties.indexName)); errors.collect(cdk.propertyValidator('keySchema', cdk.requiredValidator)(properties.keySchema)); errors.collect(cdk.propertyValidator('keySchema', cdk.listValidator(CfnGlobalTable_KeySchemaPropertyValidator))(properties.keySchema)); errors.collect(cdk.propertyValidator('projection', cdk.requiredValidator)(properties.projection)); errors.collect(cdk.propertyValidator('projection', CfnGlobalTable_ProjectionPropertyValidator)(properties.projection)); return errors.wrap('supplied properties not correct for "LocalSecondaryIndexProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.LocalSecondaryIndex` resource * * @param properties - the TypeScript properties of a `LocalSecondaryIndexProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.LocalSecondaryIndex` resource. */ // @ts-ignore TS6133 function cfnGlobalTableLocalSecondaryIndexPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_LocalSecondaryIndexPropertyValidator(properties).assertSuccess(); return { IndexName: cdk.stringToCloudFormation(properties.indexName), KeySchema: cdk.listMapper(cfnGlobalTableKeySchemaPropertyToCloudFormation)(properties.keySchema), Projection: cfnGlobalTableProjectionPropertyToCloudFormation(properties.projection), }; } // @ts-ignore TS6133 function CfnGlobalTableLocalSecondaryIndexPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('indexName', 'IndexName', cfn_parse.FromCloudFormation.getString(properties.IndexName)); ret.addPropertyResult('keySchema', 'KeySchema', cfn_parse.FromCloudFormation.getArray(CfnGlobalTableKeySchemaPropertyFromCloudFormation)(properties.KeySchema)); ret.addPropertyResult('projection', 'Projection', CfnGlobalTableProjectionPropertyFromCloudFormation(properties.Projection)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `PointInTimeRecoverySpecificationProperty` * * @param properties - the TypeScript properties of a `PointInTimeRecoverySpecificationProperty` * * @returns the result of the validation. */ function CfnGlobalTable_PointInTimeRecoverySpecificationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('pointInTimeRecoveryEnabled', cdk.validateBoolean)(properties.pointInTimeRecoveryEnabled)); return errors.wrap('supplied properties not correct for "PointInTimeRecoverySpecificationProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.PointInTimeRecoverySpecification` resource * * @param properties - the TypeScript properties of a `PointInTimeRecoverySpecificationProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.PointInTimeRecoverySpecification` resource. */ // @ts-ignore TS6133 function cfnGlobalTablePointInTimeRecoverySpecificationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_PointInTimeRecoverySpecificationPropertyValidator(properties).assertSuccess(); return { PointInTimeRecoveryEnabled: cdk.booleanToCloudFormation(properties.pointInTimeRecoveryEnabled), }; } // @ts-ignore TS6133 function CfnGlobalTablePointInTimeRecoverySpecificationPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('pointInTimeRecoveryEnabled', 'PointInTimeRecoveryEnabled', properties.PointInTimeRecoveryEnabled != null ? cfn_parse.FromCloudFormation.getBoolean(properties.PointInTimeRecoveryEnabled) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ProjectionProperty` * * @param properties - the TypeScript properties of a `ProjectionProperty` * * @returns the result of the validation. */ function CfnGlobalTable_ProjectionPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('nonKeyAttributes', cdk.listValidator(cdk.validateString))(properties.nonKeyAttributes)); errors.collect(cdk.propertyValidator('projectionType', cdk.validateString)(properties.projectionType)); return errors.wrap('supplied properties not correct for "ProjectionProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.Projection` resource * * @param properties - the TypeScript properties of a `ProjectionProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.Projection` resource. */ // @ts-ignore TS6133 function cfnGlobalTableProjectionPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_ProjectionPropertyValidator(properties).assertSuccess(); return { NonKeyAttributes: cdk.listMapper(cdk.stringToCloudFormation)(properties.nonKeyAttributes), ProjectionType: cdk.stringToCloudFormation(properties.projectionType), }; } // @ts-ignore TS6133 function CfnGlobalTableProjectionPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('nonKeyAttributes', 'NonKeyAttributes', properties.NonKeyAttributes != null ? cfn_parse.FromCloudFormation.getStringArray(properties.NonKeyAttributes) : undefined); ret.addPropertyResult('projectionType', 'ProjectionType', properties.ProjectionType != null ? cfn_parse.FromCloudFormation.getString(properties.ProjectionType) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ReadProvisionedThroughputSettingsProperty` * * @param properties - the TypeScript properties of a `ReadProvisionedThroughputSettingsProperty` * * @returns the result of the validation. */ function CfnGlobalTable_ReadProvisionedThroughputSettingsPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('readCapacityAutoScalingSettings', CfnGlobalTable_CapacityAutoScalingSettingsPropertyValidator)(properties.readCapacityAutoScalingSettings)); errors.collect(cdk.propertyValidator('readCapacityUnits', cdk.validateNumber)(properties.readCapacityUnits)); return errors.wrap('supplied properties not correct for "ReadProvisionedThroughputSettingsProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.ReadProvisionedThroughputSettings` resource * * @param properties - the TypeScript properties of a `ReadProvisionedThroughputSettingsProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.ReadProvisionedThroughputSettings` resource. */ // @ts-ignore TS6133 function cfnGlobalTableReadProvisionedThroughputSettingsPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_ReadProvisionedThroughputSettingsPropertyValidator(properties).assertSuccess(); return { ReadCapacityAutoScalingSettings: cfnGlobalTableCapacityAutoScalingSettingsPropertyToCloudFormation(properties.readCapacityAutoScalingSettings), ReadCapacityUnits: cdk.numberToCloudFormation(properties.readCapacityUnits), }; } // @ts-ignore TS6133 function CfnGlobalTableReadProvisionedThroughputSettingsPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('readCapacityAutoScalingSettings', 'ReadCapacityAutoScalingSettings', properties.ReadCapacityAutoScalingSettings != null ? CfnGlobalTableCapacityAutoScalingSettingsPropertyFromCloudFormation(properties.ReadCapacityAutoScalingSettings) : undefined); ret.addPropertyResult('readCapacityUnits', 'ReadCapacityUnits', properties.ReadCapacityUnits != null ? cfn_parse.FromCloudFormation.getNumber(properties.ReadCapacityUnits) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ReplicaGlobalSecondaryIndexSpecificationProperty` * * @param properties - the TypeScript properties of a `ReplicaGlobalSecondaryIndexSpecificationProperty` * * @returns the result of the validation. */ function CfnGlobalTable_ReplicaGlobalSecondaryIndexSpecificationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('contributorInsightsSpecification', CfnGlobalTable_ContributorInsightsSpecificationPropertyValidator)(properties.contributorInsightsSpecification)); errors.collect(cdk.propertyValidator('indexName', cdk.requiredValidator)(properties.indexName)); errors.collect(cdk.propertyValidator('indexName', cdk.validateString)(properties.indexName)); errors.collect(cdk.propertyValidator('readProvisionedThroughputSettings', CfnGlobalTable_ReadProvisionedThroughputSettingsPropertyValidator)(properties.readProvisionedThroughputSettings)); return errors.wrap('supplied properties not correct for "ReplicaGlobalSecondaryIndexSpecificationProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.ReplicaGlobalSecondaryIndexSpecification` resource * * @param properties - the TypeScript properties of a `ReplicaGlobalSecondaryIndexSpecificationProperty` * * @returns the AWS CloudFormation properties of an `AWS::DynamoDB::GlobalTable.ReplicaGlobalSecondaryIndexSpecification` resource. */ // @ts-ignore TS6133 function cfnGlobalTableReplicaGlobalSecondaryIndexSpecificationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGlobalTable_ReplicaGlobalSecondaryIndexSpecificationPropertyValidator(properties).assertSuccess(); return { ContributorInsightsSpecification: cfnGlobalTableContributorInsightsSpecificationPropertyToCloudFormation(properties.contributorInsightsSpecification), IndexName: cdk.stringToCloudFormation(properties.indexName), ReadProvisionedThroughputSettings: cfnGlobalTableReadProvisionedThroughputSettingsPropertyToCloudFormation(properties.readProvisionedThroughputSettings), }; } // @ts-ignore TS6133 function CfnGlobalTableReplicaGlobalSecondaryIndexSpecificationPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('contributorInsightsSpecification', 'ContributorInsightsSpecification', properties.ContributorInsightsSpecification != null ? CfnGlobalTableContributorInsightsSpecificationPropertyFromCloudFormation(properties.ContributorInsightsSpecification) : undefined); ret.addPropertyResult('indexName', 'IndexName', cfn_parse.FromCloudFormation.getString(properties.IndexName)); ret.addPropertyResult('readProvisionedThroughputSettings', 'ReadProvisionedThroughputSettings', properties.ReadProvisionedThroughputSettings != null ? CfnGlobalTableReadProvisionedThroughputSettingsPropertyFromCloudFormation(properties.ReadProvisionedThroughputSettings) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ReplicaSSESpecificationProperty` * * @param properties - the TypeScript properties of a `ReplicaSSESpecificationProperty` * * @returns the result of the validation. */ function CfnGlobalTable_ReplicaSSESpecificationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult