Interface AuthorizationMode
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
AuthorizationMode.Jsii$Proxy
@Generated(value="jsii-pacmak/1.94.0 (build b380f01)",
date="2024-03-14T22:21:50.353Z")
@Stability(Stable)
public interface AuthorizationMode
extends software.amazon.jsii.JsiiSerializable
Interface to specify default or additional authorization(s).
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 ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forAuthorizationModestatic final classAn implementation forAuthorizationMode -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthorizationMode.Builderbuilder()default ApiKeyConfigIf authorizationType isAuthorizationType.API_KEY, this option can be configured.One of possible four values AppSync supports.default LambdaAuthorizerConfigIf authorizationType isAuthorizationType.LAMBDA, this option is required.default OpenIdConnectConfigIf authorizationType isAuthorizationType.OIDC, this option is required.default UserPoolConfigIf authorizationType isAuthorizationType.USER_POOL, this option is required.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getAuthorizationType
One of possible four values AppSync supports.Default: - `AuthorizationType.API_KEY`
- See Also:
-
getApiKeyConfig
If authorizationType isAuthorizationType.API_KEY, this option can be configured.Default: - name: 'DefaultAPIKey' | description: 'Default API Key created by CDK'
-
getLambdaAuthorizerConfig
If authorizationType isAuthorizationType.LAMBDA, this option is required.Default: - none
-
getOpenIdConnectConfig
If authorizationType isAuthorizationType.OIDC, this option is required.Default: - none
-
getUserPoolConfig
If authorizationType isAuthorizationType.USER_POOL, this option is required.Default: - none
-
builder
- Returns:
- a
AuthorizationMode.BuilderofAuthorizationMode
-