Class PrimaryKey
(experimental) Specifies the assignment to the primary key.
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.AWS.AppSync.dll
Syntax (csharp)
public class PrimaryKey : DeputyBase
Syntax (vb)
Public Class PrimaryKey
Inherits DeputyBase
Remarks
It either contains the full primary key or only the partition key.
Stability: Experimental
ExampleMetadata: infused
Examples
var api = new GraphqlApi(this, "Api", new GraphqlApiProps {
Name = "demo",
Schema = Schema.FromAsset(Join(__dirname, "schema.graphql")),
AuthorizationConfig = new AuthorizationConfig {
DefaultAuthorization = new AuthorizationMode {
AuthorizationType = AuthorizationType.IAM
}
},
XrayEnabled = true
});
var demoTable = new Table(this, "DemoTable", new TableProps {
PartitionKey = new Attribute {
Name = "id",
Type = AttributeType.STRING
}
});
var demoDS = api.AddDynamoDbDataSource("demoDataSource", demoTable);
// Resolver for the Query "getDemos" that scans the DynamoDb table and returns the entire list.
demoDS.CreateResolver(new BaseResolverProps {
TypeName = "Query",
FieldName = "getDemos",
RequestMappingTemplate = MappingTemplate.DynamoDbScanTable(),
ResponseMappingTemplate = MappingTemplate.DynamoDbResultList()
});
// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table.
demoDS.CreateResolver(new BaseResolverProps {
TypeName = "Mutation",
FieldName = "addDemo",
RequestMappingTemplate = MappingTemplate.DynamoDbPutItem(PrimaryKey.Partition("id").Auto(), Values.Projecting("input")),
ResponseMappingTemplate = MappingTemplate.DynamoDbResultItem()
});
Synopsis
Constructors
PrimaryKey(Assign, Assign) | |
PrimaryKey(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
PrimaryKey(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Pkey |
Methods
Partition(String) | (experimental) Allows assigning a value to the partition key. |
RenderTemplate() | (experimental) Renders the key assignment to a VTL string. |
Constructors
PrimaryKey(Assign, Assign)
public PrimaryKey(Assign pkey, Assign skey = null)
Parameters
Remarks
Stability: Experimental
PrimaryKey(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected PrimaryKey(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
PrimaryKey(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected PrimaryKey(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Pkey
Methods
Partition(String)
(experimental) Allows assigning a value to the partition key.
public static PartitionKeyStep Partition(string key)
Parameters
- key System.String
Returns
Remarks
Stability: Experimental
RenderTemplate()
(experimental) Renders the key assignment to a VTL string.
public virtual string RenderTemplate()
Returns
System.String
Remarks
Stability: Experimental