Class AuthorizationConfig
Configuration of the API authorization modes.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AuthorizationConfig : IAuthorizationConfig
Syntax (vb)
Public Class AuthorizationConfig Implements IAuthorizationConfig
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.AppSync;
var api = new GraphqlApi(this, "api", new GraphqlApiProps {
Name = "api",
Definition = Definition.FromFile("schema.graphql"),
AuthorizationConfig = new AuthorizationConfig {
DefaultAuthorization = new AuthorizationMode { AuthorizationType = AuthorizationType.IAM }
}
});
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Hours(1))
});
rule.AddTarget(new AppSync(api, new AppSyncGraphQLApiProps {
GraphQLOperation = "mutation Publish($message: String!){ publish(message: $message) { message } }",
Variables = RuleTargetInput.FromObject(new Dictionary<string, string> {
{ "message", "hello world" }
})
}));
Synopsis
Constructors
| AuthorizationConfig() | Configuration of the API authorization modes. |
Properties
| AdditionalAuthorizationModes | Additional authorization modes. |
| DefaultAuthorization | Optional authorization configuration. |
Constructors
AuthorizationConfig()
Configuration of the API authorization modes.
public AuthorizationConfig()
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.AppSync;
var api = new GraphqlApi(this, "api", new GraphqlApiProps {
Name = "api",
Definition = Definition.FromFile("schema.graphql"),
AuthorizationConfig = new AuthorizationConfig {
DefaultAuthorization = new AuthorizationMode { AuthorizationType = AuthorizationType.IAM }
}
});
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Hours(1))
});
rule.AddTarget(new AppSync(api, new AppSyncGraphQLApiProps {
GraphQLOperation = "mutation Publish($message: String!){ publish(message: $message) { message } }",
Variables = RuleTargetInput.FromObject(new Dictionary<string, string> {
{ "message", "hello world" }
})
}));
Properties
AdditionalAuthorizationModes
Additional authorization modes.
public IAuthorizationMode[]? AdditionalAuthorizationModes { get; set; }
Property Value
Remarks
Default: - No other modes
DefaultAuthorization
Optional authorization configuration.
public IAuthorizationMode? DefaultAuthorization { get; set; }
Property Value
Remarks
Default: - API Key authorization