Class AuthorizationType
enum with all possible values for AppSync authorization type.
Inheritance
System.Object
AuthorizationType
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public sealed class AuthorizationType : Enum
Syntax (vb)
Public NotInheritable Class AuthorizationType
Inherits
Enum
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
Fields
API_KEY | API Key authorization type. |
IAM | AWS IAM authorization type. |
LAMBDA | Lambda authorization type. |
OIDC | OpenID Connect authorization type. |
USER_POOL | Cognito User Pool authorization type. |
value__ |
Fields
API_KEY
API Key authorization type.
public const AuthorizationType API_KEY
Field Value
Type | Description |
---|---|
AuthorizationType |
IAM
AWS IAM authorization type.
public const AuthorizationType IAM
Field Value
Type | Description |
---|---|
AuthorizationType |
Remarks
Can be used with Cognito Identity Pool federated credentials
LAMBDA
Lambda authorization type.
public const AuthorizationType LAMBDA
Field Value
Type | Description |
---|---|
AuthorizationType |
OIDC
OpenID Connect authorization type.
public const AuthorizationType OIDC
Field Value
Type | Description |
---|---|
AuthorizationType |
USER_POOL
Cognito User Pool authorization type.
public const AuthorizationType USER_POOL
Field Value
Type | Description |
---|---|
AuthorizationType |
value__
public int value__
Field Value
Type | Description |
---|---|
System.Int32 |