Class AuthorizationConfig
(experimental) Configuration of the API authorization modes.
Inheritance
System.Object
AuthorizationConfig
Implements
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.AWS.AppSync.dll
Syntax (csharp)
public class AuthorizationConfig : Object, IAuthorizationConfig
Syntax (vb)
Public Class AuthorizationConfig
Inherits Object
Implements IAuthorizationConfig
Remarks
Stability: Experimental
ExampleMetadata: infused
Examples
var api = new GraphqlApi(this, "Api", new GraphqlApiProps {
Name = "demo",
Schema = Schema.FromAsset(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.
demoDS.CreateResolver(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(new BaseResolverProps {
TypeName = "Mutation",
FieldName = "addDemo",
RequestMappingTemplate = MappingTemplate.DynamoDbPutItem(PrimaryKey.Partition("id").Auto(), Values.Projecting("input")),
ResponseMappingTemplate = MappingTemplate.DynamoDbResultItem()
});
Synopsis
Constructors
AuthorizationConfig() |
Properties
AdditionalAuthorizationModes | (experimental) Additional authorization modes. |
DefaultAuthorization | (experimental) Optional authorization configuration. |
Constructors
AuthorizationConfig()
public AuthorizationConfig()
Properties
AdditionalAuthorizationModes
(experimental) Additional authorization modes.
public IAuthorizationMode[] AdditionalAuthorizationModes { get; set; }
Property Value
Remarks
Default: - No other modes
Stability: Experimental
DefaultAuthorization
(experimental) Optional authorization configuration.
public IAuthorizationMode DefaultAuthorization { get; set; }
Property Value
Remarks
Default: - API Key authorization
Stability: Experimental