Class AttributeValues
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.appsync.AttributeValues
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-13T16:09:58.883Z")
@Stability(Stable)
public class AttributeValues
extends software.amazon.jsii.JsiiObject
Specifies the attribute value assignments.
Example:
GraphqlApi api = GraphqlApi.Builder.create(this, "Api")
.name("demo")
.definition(Definition.fromFile(join(__dirname, "schema.graphql")))
.authorizationConfig(AuthorizationConfig.builder()
.defaultAuthorization(AuthorizationMode.builder()
.authorizationType(AuthorizationType.IAM)
.build())
.build())
.xrayEnabled(true)
.build();
Table demoTable = Table.Builder.create(this, "DemoTable")
.partitionKey(Attribute.builder()
.name("id")
.type(AttributeType.STRING)
.build())
.build();
DynamoDbDataSource 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", BaseResolverProps.builder()
.typeName("Query")
.fieldName("getDemos")
.requestMappingTemplate(MappingTemplate.dynamoDbScanTable())
.responseMappingTemplate(MappingTemplate.dynamoDbResultList())
.build());
// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table.
demoDS.createResolver("MutationAddDemoResolver", BaseResolverProps.builder()
.typeName("Mutation")
.fieldName("addDemo")
.requestMappingTemplate(MappingTemplate.dynamoDbPutItem(PrimaryKey.partition("id").auto(), Values.projecting("input")))
.responseMappingTemplate(MappingTemplate.dynamoDbResultItem())
.build());
//To enable DynamoDB read consistency with the `MappingTemplate`:
demoDS.createResolver("QueryGetDemosConsistentResolver", BaseResolverProps.builder()
.typeName("Query")
.fieldName("getDemosConsistent")
.requestMappingTemplate(MappingTemplate.dynamoDbScanTable(true))
.responseMappingTemplate(MappingTemplate.dynamoDbResultList())
.build());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionAttributeValues(String container) AttributeValues(String container, List<Assign> assignments) protectedAttributeValues(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedAttributeValues(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionAllows assigning a value to the specified attribute.Renders the attribute value assingments to a VTL string.Renders the variables required forrenderTemplate.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
AttributeValues
protected AttributeValues(software.amazon.jsii.JsiiObjectRef objRef) -
AttributeValues
protected AttributeValues(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
AttributeValues
@Stability(Stable) public AttributeValues(@NotNull String container, @Nullable List<Assign> assignments) - Parameters:
container- This parameter is required.assignments-
-
AttributeValues
- Parameters:
container- This parameter is required.
-
-
Method Details
-
attribute
Allows assigning a value to the specified attribute.- Parameters:
attr- This parameter is required.
-
renderTemplate
Renders the attribute value assingments to a VTL string. -
renderVariables
Renders the variables required forrenderTemplate.
-