Enum AuthorizationType

java.lang.Object
java.lang.Enum<AuthorizationType>
software.amazon.awscdk.services.appsync.AuthorizationType
All Implemented Interfaces:
Serializable, Comparable<AuthorizationType>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.95.0 (build f1ff514)", date="2024-03-26T18:09:19.723Z") @Stability(Stable) public enum AuthorizationType extends Enum<AuthorizationType>
enum with all possible values for AppSync authorization type.

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());
 
  • Enum Constant Details

    • API_KEY

      @Stability(Stable) public static final AuthorizationType API_KEY
      API Key authorization type.
    • IAM

      @Stability(Stable) public static final AuthorizationType IAM
      AWS IAM authorization type.

      Can be used with Cognito Identity Pool federated credentials

    • USER_POOL

      @Stability(Stable) public static final AuthorizationType USER_POOL
      Cognito User Pool authorization type.
    • OIDC

      @Stability(Stable) public static final AuthorizationType OIDC
      OpenID Connect authorization type.
    • LAMBDA

      @Stability(Stable) public static final AuthorizationType LAMBDA
      Lambda authorization type.
  • Method Details

    • values

      public static AuthorizationType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static AuthorizationType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null