Skip to content

Latest commit

 

History

History
809 lines (467 loc) · 30.9 KB

File metadata and controls

809 lines (467 loc) · 30.9 KB

API Reference

Constructs

Table

Initializers

import { Table } from 'aws-dynamodb-table-multi-gsis'

new Table(scope: Construct, id: string, props: TableProps)
Name Type Description
scope @aws-cdk/core.Construct No description.
id string No description.
props @aws-cdk/aws-dynamodb.TableProps No description.

scopeRequired
  • Type: @aws-cdk/core.Construct

idRequired
  • Type: string

propsRequired
  • Type: @aws-cdk/aws-dynamodb.TableProps

Methods

Name Description
toString Returns a string representation of this construct.
applyRemovalPolicy Apply the given removal policy to this resource.
addGlobalSecondaryIndex Add a global secondary index of table.
addLocalSecondaryIndex Add a local secondary index of table.
autoScaleGlobalSecondaryIndexReadCapacity Enable read capacity scaling for the given GSI.
autoScaleGlobalSecondaryIndexWriteCapacity Enable write capacity scaling for the given GSI.
autoScaleReadCapacity Enable read capacity scaling for this table.
autoScaleWriteCapacity Enable write capacity scaling for this table.
grant Adds an IAM policy statement associated with this table to an IAM principal's policy.
grantFullAccess Permits all DynamoDB operations ("dynamodb:*") to an IAM principal.
grantReadData Permits an IAM principal all data read operations from this table: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan.
grantReadWriteData Permits an IAM principal to all data read/write operations to this table.
grantStream Adds an IAM policy statement associated with this table's stream to an IAM principal's policy.
grantStreamRead Permits an IAM principal all stream data read operations for this table's stream: DescribeStream, GetRecords, GetShardIterator, ListStreams.
grantTableListStreams Permits an IAM Principal to list streams attached to current dynamodb table.
grantWriteData Permits an IAM principal all data write operations to this table: BatchWriteItem, PutItem, UpdateItem, DeleteItem.
metric Return the given named metric for this Table.
metricConditionalCheckFailedRequests Metric for the conditional check failed requests this table.
metricConsumedReadCapacityUnits Metric for the consumed read capacity units this table.
metricConsumedWriteCapacityUnits Metric for the consumed write capacity units this table.
metricSuccessfulRequestLatency Metric for the successful request latency this table.
metricSystemErrors Metric for the system errors this table.
metricSystemErrorsForOperations Metric for the system errors this table.
metricThrottledRequests How many requests are throttled on this table.
metricThrottledRequestsForOperation How many requests are throttled on this table, for the given operation.
metricUserErrors Metric for the user errors.
schema Get schema attributes of table or index.

toString
public toString(): string

Returns a string representation of this construct.

applyRemovalPolicy
public applyRemovalPolicy(policy: RemovalPolicy): void

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced. The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

policyRequired
  • Type: @aws-cdk/core.RemovalPolicy

addGlobalSecondaryIndex
public addGlobalSecondaryIndex(props: GlobalSecondaryIndexProps): void

Add a global secondary index of table.

propsRequired
  • Type: @aws-cdk/aws-dynamodb.GlobalSecondaryIndexProps

the property of global secondary index.


addLocalSecondaryIndex
public addLocalSecondaryIndex(props: LocalSecondaryIndexProps): void

Add a local secondary index of table.

propsRequired
  • Type: @aws-cdk/aws-dynamodb.LocalSecondaryIndexProps

the property of local secondary index.


autoScaleGlobalSecondaryIndexReadCapacity
public autoScaleGlobalSecondaryIndexReadCapacity(indexName: string, props: EnableScalingProps): IScalableTableAttribute

Enable read capacity scaling for the given GSI.

indexNameRequired
  • Type: string

propsRequired
  • Type: @aws-cdk/aws-dynamodb.EnableScalingProps

autoScaleGlobalSecondaryIndexWriteCapacity
public autoScaleGlobalSecondaryIndexWriteCapacity(indexName: string, props: EnableScalingProps): IScalableTableAttribute

Enable write capacity scaling for the given GSI.

indexNameRequired
  • Type: string

propsRequired
  • Type: @aws-cdk/aws-dynamodb.EnableScalingProps

autoScaleReadCapacity
public autoScaleReadCapacity(props: EnableScalingProps): IScalableTableAttribute

Enable read capacity scaling for this table.

propsRequired
  • Type: @aws-cdk/aws-dynamodb.EnableScalingProps

autoScaleWriteCapacity
public autoScaleWriteCapacity(props: EnableScalingProps): IScalableTableAttribute

Enable write capacity scaling for this table.

propsRequired
  • Type: @aws-cdk/aws-dynamodb.EnableScalingProps

grant
public grant(grantee: IGrantable, actions: string): Grant

Adds an IAM policy statement associated with this table to an IAM principal's policy.

If encryptionKey is present, appropriate grants to the key needs to be added separately using the table.encryptionKey.grant* methods.

granteeRequired
  • Type: @aws-cdk/aws-iam.IGrantable

The principal (no-op if undefined).


actionsRequired
  • Type: string

The set of actions to allow (i.e. "dynamodb:PutItem", "dynamodb:GetItem", ...).


grantFullAccess
public grantFullAccess(grantee: IGrantable): Grant

Permits all DynamoDB operations ("dynamodb:*") to an IAM principal.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

granteeRequired
  • Type: @aws-cdk/aws-iam.IGrantable

The principal to grant access to.


grantReadData
public grantReadData(grantee: IGrantable): Grant

Permits an IAM principal all data read operations from this table: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

granteeRequired
  • Type: @aws-cdk/aws-iam.IGrantable

The principal to grant access to.


grantReadWriteData
public grantReadWriteData(grantee: IGrantable): Grant

Permits an IAM principal to all data read/write operations to this table.

BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, BatchWriteItem, PutItem, UpdateItem, DeleteItem Appropriate grants will also be added to the customer-managed KMS key if one was configured.

granteeRequired
  • Type: @aws-cdk/aws-iam.IGrantable

The principal to grant access to.


grantStream
public grantStream(grantee: IGrantable, actions: string): Grant

Adds an IAM policy statement associated with this table's stream to an IAM principal's policy.

If encryptionKey is present, appropriate grants to the key needs to be added separately using the table.encryptionKey.grant* methods.

granteeRequired
  • Type: @aws-cdk/aws-iam.IGrantable

The principal (no-op if undefined).


actionsRequired
  • Type: string

The set of actions to allow (i.e. "dynamodb:DescribeStream", "dynamodb:GetRecords", ...).


grantStreamRead
public grantStreamRead(grantee: IGrantable): Grant

Permits an IAM principal all stream data read operations for this table's stream: DescribeStream, GetRecords, GetShardIterator, ListStreams.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

granteeRequired
  • Type: @aws-cdk/aws-iam.IGrantable

The principal to grant access to.


grantTableListStreams
public grantTableListStreams(grantee: IGrantable): Grant

Permits an IAM Principal to list streams attached to current dynamodb table.

granteeRequired
  • Type: @aws-cdk/aws-iam.IGrantable

The principal (no-op if undefined).


grantWriteData
public grantWriteData(grantee: IGrantable): Grant

Permits an IAM principal all data write operations to this table: BatchWriteItem, PutItem, UpdateItem, DeleteItem.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

granteeRequired
  • Type: @aws-cdk/aws-iam.IGrantable

The principal to grant access to.


metric
public metric(metricName: string, props?: MetricOptions): Metric

Return the given named metric for this Table.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

metricNameRequired
  • Type: string

propsOptional
  • Type: @aws-cdk/aws-cloudwatch.MetricOptions

metricConditionalCheckFailedRequests
public metricConditionalCheckFailedRequests(props?: MetricOptions): Metric

Metric for the conditional check failed requests this table.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

propsOptional
  • Type: @aws-cdk/aws-cloudwatch.MetricOptions

metricConsumedReadCapacityUnits
public metricConsumedReadCapacityUnits(props?: MetricOptions): Metric

Metric for the consumed read capacity units this table.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

propsOptional
  • Type: @aws-cdk/aws-cloudwatch.MetricOptions

metricConsumedWriteCapacityUnits
public metricConsumedWriteCapacityUnits(props?: MetricOptions): Metric

Metric for the consumed write capacity units this table.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

propsOptional
  • Type: @aws-cdk/aws-cloudwatch.MetricOptions

metricSuccessfulRequestLatency
public metricSuccessfulRequestLatency(props?: MetricOptions): Metric

Metric for the successful request latency this table.

By default, the metric will be calculated as an average over a period of 5 minutes. You can customize this by using the statistic and period properties.

propsOptional
  • Type: @aws-cdk/aws-cloudwatch.MetricOptions

metricSystemErrors
public metricSystemErrors(props?: MetricOptions): Metric

Metric for the system errors this table.

propsOptional
  • Type: @aws-cdk/aws-cloudwatch.MetricOptions

metricSystemErrorsForOperations
public metricSystemErrorsForOperations(props?: SystemErrorsForOperationsMetricOptions): IMetric

Metric for the system errors this table.

This will sum errors across all possible operations. Note that by default, each individual metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

propsOptional
  • Type: @aws-cdk/aws-dynamodb.SystemErrorsForOperationsMetricOptions

metricThrottledRequests
public metricThrottledRequests(props?: MetricOptions): Metric

How many requests are throttled on this table.

Default: sum over 5 minutes

propsOptional
  • Type: @aws-cdk/aws-cloudwatch.MetricOptions

metricThrottledRequestsForOperation
public metricThrottledRequestsForOperation(operation: string, props?: MetricOptions): Metric

How many requests are throttled on this table, for the given operation.

Default: sum over 5 minutes

operationRequired
  • Type: string

propsOptional
  • Type: @aws-cdk/aws-cloudwatch.MetricOptions

metricUserErrors
public metricUserErrors(props?: MetricOptions): Metric

Metric for the user errors.

Note that this metric reports user errors across all the tables in the account and region the table resides in. By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

propsOptional
  • Type: @aws-cdk/aws-cloudwatch.MetricOptions

schema
public schema(indexName?: string): SchemaOptions

Get schema attributes of table or index.

indexNameOptional
  • Type: string

Static Functions

Name Description
isConstruct Return whether the given object is a Construct.
isResource Check whether the given construct is a Resource.
fromTableArn Creates a Table construct that represents an external table via table arn.
fromTableAttributes Creates a Table construct that represents an external table.
fromTableName Creates a Table construct that represents an external table via table name.
grantListStreams Permits an IAM Principal to list all DynamoDB Streams.

isConstruct
import { Table } from 'aws-dynamodb-table-multi-gsis'

Table.isConstruct(x: any)

Return whether the given object is a Construct.

xRequired
  • Type: any

isResource
import { Table } from 'aws-dynamodb-table-multi-gsis'

Table.isResource(construct: IConstruct)

Check whether the given construct is a Resource.

constructRequired
  • Type: @aws-cdk/core.IConstruct

fromTableArn
import { Table } from 'aws-dynamodb-table-multi-gsis'

Table.fromTableArn(scope: Construct, id: string, tableArn: string)

Creates a Table construct that represents an external table via table arn.

scopeRequired
  • Type: constructs.Construct

The parent creating construct (usually this).


idRequired
  • Type: string

The construct's name.


tableArnRequired
  • Type: string

The table's ARN.


fromTableAttributes
import { Table } from 'aws-dynamodb-table-multi-gsis'

Table.fromTableAttributes(scope: Construct, id: string, attrs: TableAttributes)

Creates a Table construct that represents an external table.

scopeRequired
  • Type: constructs.Construct

The parent creating construct (usually this).


idRequired
  • Type: string

The construct's name.


attrsRequired
  • Type: @aws-cdk/aws-dynamodb.TableAttributes

A TableAttributes object.


fromTableName
import { Table } from 'aws-dynamodb-table-multi-gsis'

Table.fromTableName(scope: Construct, id: string, tableName: string)

Creates a Table construct that represents an external table via table name.

scopeRequired
  • Type: constructs.Construct

The parent creating construct (usually this).


idRequired
  • Type: string

The construct's name.


tableNameRequired
  • Type: string

The table's name.


grantListStreams
import { Table } from 'aws-dynamodb-table-multi-gsis'

Table.grantListStreams(grantee: IGrantable)

Permits an IAM Principal to list all DynamoDB Streams.

granteeRequired
  • Type: @aws-cdk/aws-iam.IGrantable

The principal (no-op if undefined).


Properties

Name Type Description
node @aws-cdk/core.ConstructNode The construct tree node associated with this construct.
env @aws-cdk/core.ResourceEnvironment The environment this resource belongs to.
stack @aws-cdk/core.Stack The stack in which this resource is defined.
tableArn string Arn of the dynamodb table.
tableName string Table name of the dynamodb table.
encryptionKey @aws-cdk/aws-kms.IKey KMS encryption key, if this table uses a customer-managed encryption key.
tableStreamArn string ARN of the table's stream, if there is one.

nodeRequired
public readonly node: ConstructNode;
  • Type: @aws-cdk/core.ConstructNode

The construct tree node associated with this construct.


envRequired
public readonly env: ResourceEnvironment;
  • Type: @aws-cdk/core.ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


stackRequired
public readonly stack: Stack;
  • Type: @aws-cdk/core.Stack

The stack in which this resource is defined.


tableArnRequired
public readonly tableArn: string;
  • Type: string

Arn of the dynamodb table.


tableNameRequired
public readonly tableName: string;
  • Type: string

Table name of the dynamodb table.


encryptionKeyOptional
public readonly encryptionKey: IKey;
  • Type: @aws-cdk/aws-kms.IKey

KMS encryption key, if this table uses a customer-managed encryption key.


tableStreamArnOptional
public readonly tableStreamArn: string;
  • Type: string

ARN of the table's stream, if there is one.