Class AttributeValues
Specifies the attribute value assignments.
Inheritance
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AttributeValues : DeputyBase
Syntax (vb)
Public Class AttributeValues
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
var api = new GraphqlApi(this, "Api", new GraphqlApiProps {
Name = "demo",
Definition = Definition.FromFile(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.
// Resolver Mapping Template Reference:
// https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html
demoDS.CreateResolver("QueryGetDemosResolver", 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("MutationAddDemoResolver", new BaseResolverProps {
TypeName = "Mutation",
FieldName = "addDemo",
RequestMappingTemplate = MappingTemplate.DynamoDbPutItem(PrimaryKey.Partition("id").Auto(), Values.Projecting("input")),
ResponseMappingTemplate = MappingTemplate.DynamoDbResultItem()
});
//To enable DynamoDB read consistency with the `MappingTemplate`:
demoDS.CreateResolver("QueryGetDemosConsistentResolver", new BaseResolverProps {
TypeName = "Query",
FieldName = "getDemosConsistent",
RequestMappingTemplate = MappingTemplate.DynamoDbScanTable(true),
ResponseMappingTemplate = MappingTemplate.DynamoDbResultList()
});
Synopsis
Constructors
AttributeValues(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
AttributeValues(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
AttributeValues(String, Assign[]) |
Methods
Attribute(String) | Allows assigning a value to the specified attribute. |
RenderTemplate() | Renders the attribute value assingments to a VTL string. |
RenderVariables() | Renders the variables required for |
Constructors
AttributeValues(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected AttributeValues(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
AttributeValues(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected AttributeValues(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
AttributeValues(String, Assign[])
public AttributeValues(string container, Assign[] assignments = null)
Parameters
- container System.String
- assignments Assign[]
Methods
Attribute(String)
Allows assigning a value to the specified attribute.
public virtual AttributeValuesStep Attribute(string attr)
Parameters
- attr System.String
Returns
RenderTemplate()
Renders the attribute value assingments to a VTL string.
public virtual string RenderTemplate()
Returns
System.String
RenderVariables()
Renders the variables required for renderTemplate
.
public virtual string RenderVariables()
Returns
System.String