Skip to content
v2.275.0

PartitionKey Class ​

Specifies the assignment to the partition key.

It can be enhanced with the assignment of the sort key.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';

declare const assign: appsync.Assign;
const partitionKey = new appsync.PartitionKey(assign);
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_appsync as appsync

# assign: appsync.Assign

partition_key = appsync.PartitionKey(assign)
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.appsync.*;

Assign assign;

PartitionKey partitionKey = new PartitionKey(assign);
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.AppSync;

Assign assign;

var partitionKey = new PartitionKey(assign);
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"

var assign Assign

partitionKey := awscdk.Aws_appsync.NewPartitionKey(assign)

Initializer ​

ts
new PartitionKey(pkey: Assign)
python
PartitionKey(pkey: Assign)
java
new PartitionKey(Assign pkey)
csharp
new PartitionKey(Assign pkey)
go
NewPartitionKey(Pkey Assign)

Methods ​

partition(key: string): PartitionKeyStep@staticmethod def partition(key: str) -> PartitionKeySteppublic static PartitionKeyStep partition(String key)public static PartitionKeyStep Partition(string key)func Partition(Key *string) PartitionKeyStepstatic#
Allows assigning a value to the partition key.
renderTemplate(): stringdef render_template(self, ) -> strpublic String renderTemplate()public string RenderTemplate()func RenderTemplate() *string#
Renders the key assignment to a VTL string.
sort(key: string): SortKeyStepdef sort(self, key: str) -> SortKeySteppublic SortKeyStep sort(String key)public SortKeyStep Sort(string key)func Sort(Key *string) SortKeyStep#
Allows assigning a value to the sort key.