KeySchema Struct
A description of a key schema of an LSI, GSI or Table.
| Source | aws-dynamodb/lib/shared.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_dynamodb as dynamodb } from 'aws-cdk-lib';
const keySchema: dynamodb.KeySchema = {
partitionKeys: [{
name: 'name',
type: dynamodb.AttributeType.BINARY,
}],
sortKeys: [{
name: 'name',
type: dynamodb.AttributeType.BINARY,
}],
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_dynamodb as dynamodb
key_schema = dynamodb.KeySchema(
partition_keys=[dynamodb.Attribute(
name="name",
type=dynamodb.AttributeType.BINARY
)],
sort_keys=[dynamodb.Attribute(
name="name",
type=dynamodb.AttributeType.BINARY
)]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.dynamodb.*;
KeySchema keySchema = KeySchema.builder()
.partitionKeys(List.of(Attribute.builder()
.name("name")
.type(AttributeType.BINARY)
.build()))
.sortKeys(List.of(Attribute.builder()
.name("name")
.type(AttributeType.BINARY)
.build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.DynamoDB;
var keySchema = new KeySchema {
PartitionKeys = new [] { new Attribute {
Name = "name",
Type = AttributeType.BINARY
} },
SortKeys = new [] { new Attribute {
Name = "name",
Type = AttributeType.BINARY
} }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
keySchema := &KeySchema{
PartitionKeys: []Attribute{
&Attribute{
Name: jsii.String("name"),
Type: awscdk.Aws_dynamodb.AttributeType_BINARY,
},
},
SortKeys: []Attribute{
&Attribute{
Name: jsii.String("name"),
Type: awscdk.*Aws_dynamodb.AttributeType_BINARY,
},
},
}