Interface AuthorizationMode

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
AuthorizationMode.Jsii$Proxy

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:49.361Z") @Stability(Experimental) public interface AuthorizationMode extends software.amazon.jsii.JsiiSerializable
(experimental) Interface to specify default or additional authorization(s).

Example:

 GraphqlApi api = GraphqlApi.Builder.create(this, "Api")
         .name("demo")
         .schema(Schema.fromAsset(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.
 demoDS.createResolver(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(BaseResolverProps.builder()
         .typeName("Mutation")
         .fieldName("addDemo")
         .requestMappingTemplate(MappingTemplate.dynamoDbPutItem(PrimaryKey.partition("id").auto(), Values.projecting("input")))
         .responseMappingTemplate(MappingTemplate.dynamoDbResultItem())
         .build());
 
  • Method Details

    • getAuthorizationType

      @Stability(Experimental) @NotNull AuthorizationType getAuthorizationType()
      (experimental) One of possible four values AppSync supports.

      Default: - `AuthorizationType.API_KEY`

      See Also:
    • getApiKeyConfig

      @Stability(Experimental) @Nullable default ApiKeyConfig getApiKeyConfig()
      (experimental) If authorizationType is AuthorizationType.API_KEY, this option can be configured.

      Default: - name: 'DefaultAPIKey' | description: 'Default API Key created by CDK'

    • getLambdaAuthorizerConfig

      @Stability(Experimental) @Nullable default LambdaAuthorizerConfig getLambdaAuthorizerConfig()
      (experimental) If authorizationType is AuthorizationType.LAMBDA, this option is required.

      Default: - none

    • getOpenIdConnectConfig

      @Stability(Experimental) @Nullable default OpenIdConnectConfig getOpenIdConnectConfig()
      (experimental) If authorizationType is AuthorizationType.OIDC, this option is required.

      Default: - none

    • getUserPoolConfig

      @Stability(Experimental) @Nullable default UserPoolConfig getUserPoolConfig()
      (experimental) If authorizationType is AuthorizationType.USER_POOL, this option is required.

      Default: - none

    • builder

      @Stability(Experimental) static AuthorizationMode.Builder builder()
      Returns:
      a AuthorizationMode.Builder of AuthorizationMode