AppSyncAuthorizationType Enum
enum with all possible values for AppSync authorization type.
| Source | aws-appsync/lib/auth-config.ts |
|---|---|
| Type last changed |
Example
ts
import * as logs from 'aws-cdk-lib/aws-logs';
const apiKeyProvider: appsync.AppSyncAuthProvider = {
authorizationType: appsync.AppSyncAuthorizationType.API_KEY,
};
const api = new appsync.EventApi(this, 'api', {
apiName: 'Api',
ownerContact: 'OwnerContact',
authorizationConfig: {
authProviders: [
apiKeyProvider,
],
connectionAuthModeTypes: [
appsync.AppSyncAuthorizationType.API_KEY,
],
defaultPublishAuthModeTypes: [
appsync.AppSyncAuthorizationType.API_KEY,
],
defaultSubscribeAuthModeTypes: [
appsync.AppSyncAuthorizationType.API_KEY,
],
},
logConfig: {
fieldLogLevel: appsync.AppSyncFieldLogLevel.INFO,
retention: logs.RetentionDays.ONE_WEEK,
},
});
api.addChannelNamespace('default');
python
import aws_cdk.aws_logs as logs
api_key_provider = appsync.AppSyncAuthProvider(
authorization_type=appsync.AppSyncAuthorizationType.API_KEY
)
api = appsync.EventApi(self, "api",
api_name="Api",
owner_contact="OwnerContact",
authorization_config=appsync.EventApiAuthConfig(
auth_providers=[api_key_provider
],
connection_auth_mode_types=[appsync.AppSyncAuthorizationType.API_KEY
],
default_publish_auth_mode_types=[appsync.AppSyncAuthorizationType.API_KEY
],
default_subscribe_auth_mode_types=[appsync.AppSyncAuthorizationType.API_KEY
]
),
log_config=appsync.AppSyncLogConfig(
field_log_level=appsync.AppSyncFieldLogLevel.INFO,
retention=logs.RetentionDays.ONE_WEEK
)
)
api.add_channel_namespace("default")
java
import software.amazon.awscdk.services.logs.*;
AppSyncAuthProvider apiKeyProvider = AppSyncAuthProvider.builder()
.authorizationType(AppSyncAuthorizationType.API_KEY)
.build();
EventApi api = EventApi.Builder.create(this, "api")
.apiName("Api")
.ownerContact("OwnerContact")
.authorizationConfig(EventApiAuthConfig.builder()
.authProviders(List.of(apiKeyProvider))
.connectionAuthModeTypes(List.of(AppSyncAuthorizationType.API_KEY))
.defaultPublishAuthModeTypes(List.of(AppSyncAuthorizationType.API_KEY))
.defaultSubscribeAuthModeTypes(List.of(AppSyncAuthorizationType.API_KEY))
.build())
.logConfig(AppSyncLogConfig.builder()
.fieldLogLevel(AppSyncFieldLogLevel.INFO)
.retention(RetentionDays.ONE_WEEK)
.build())
.build();
api.addChannelNamespace("default");
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.Logs;
var apiKeyProvider = new AppSyncAuthProvider {
AuthorizationType = AppSyncAuthorizationType.API_KEY
};
var api = new EventApi(this, "api", new EventApiProps {
ApiName = "Api",
OwnerContact = "OwnerContact",
AuthorizationConfig = new EventApiAuthConfig {
AuthProviders = new [] { apiKeyProvider },
ConnectionAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY },
DefaultPublishAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY },
DefaultSubscribeAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY }
},
LogConfig = new AppSyncLogConfig {
FieldLogLevel = AppSyncFieldLogLevel.INFO,
Retention = RetentionDays.ONE_WEEK
}
});
api.AddChannelNamespace("default");
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import logs "github.com/aws/aws-cdk-go/awscdk"
apiKeyProvider := &AppSyncAuthProvider{
AuthorizationType: appsync.AppSyncAuthorizationType_API_KEY,
}
api := appsync.NewEventApi(this, jsii.String("api"), &EventApiProps{
ApiName: jsii.String("Api"),
OwnerContact: jsii.String("OwnerContact"),
AuthorizationConfig: &EventApiAuthConfig{
AuthProviders: []AppSyncAuthProvider{
apiKeyProvider,
},
ConnectionAuthModeTypes: []AppSyncAuthorizationType{
appsync.AppSyncAuthorizationType_API_KEY,
},
DefaultPublishAuthModeTypes: []AppSyncAuthorizationType{
appsync.AppSyncAuthorizationType_API_KEY,
},
DefaultSubscribeAuthModeTypes: []AppSyncAuthorizationType{
appsync.AppSyncAuthorizationType_API_KEY,
},
},
LogConfig: &AppSyncLogConfig{
FieldLogLevel: appsync.AppSyncFieldLogLevel_INFO,
Retention: logs.RetentionDays_ONE_WEEK,
},
})
api.AddChannelNamespace(jsii.String("default"))
Members
| Member | Description |
|---|---|
API_KEY | API Key authorization type. |
IAM | AWS IAM authorization type. |
USER_POOL | Cognito User Pool authorization type. |
OIDC | OpenID Connect authorization type. |
LAMBDA | Lambda authorization type. |
Referenced by
AppSyncAuthProvider.authorizationTypeauthorization_typeauthorizationTypeAuthorizationTypeAuthorizationTypeEventApi.authProviderTypesauth_provider_typesauthProviderTypesAuthProviderTypesAuthProviderTypesEventApi.connectionModeTypesconnection_mode_typesconnectionModeTypesConnectionModeTypesConnectionModeTypesEventApi.defaultPublishModeTypesdefault_publish_mode_typesdefaultPublishModeTypesDefaultPublishModeTypesDefaultPublishModeTypesEventApi.defaultSubscribeModeTypesdefault_subscribe_mode_typesdefaultSubscribeModeTypesDefaultSubscribeModeTypesDefaultSubscribeModeTypesEventApiAttributes.authProviderTypesauth_provider_typesauthProviderTypesAuthProviderTypesAuthProviderTypesEventApiAuthConfig.connectionAuthModeTypesconnection_auth_mode_typesconnectionAuthModeTypesConnectionAuthModeTypesConnectionAuthModeTypesEventApiAuthConfig.defaultPublishAuthModeTypesdefault_publish_auth_mode_typesdefaultPublishAuthModeTypesDefaultPublishAuthModeTypesDefaultPublishAuthModeTypesEventApiAuthConfig.defaultSubscribeAuthModeTypesdefault_subscribe_auth_mode_typesdefaultSubscribeAuthModeTypesDefaultSubscribeAuthModeTypesDefaultSubscribeAuthModeTypesEventApiBase.authProviderTypesauth_provider_typesauthProviderTypesAuthProviderTypesAuthProviderTypesIEventApi.authProviderTypesauth_provider_typesauthProviderTypesAuthProviderTypesAuthProviderTypesNamespaceAuthConfig.publishAuthModeTypespublish_auth_mode_typespublishAuthModeTypesPublishAuthModeTypesPublishAuthModeTypesNamespaceAuthConfig.subscribeAuthModeTypessubscribe_auth_mode_typessubscribeAuthModeTypesSubscribeAuthModeTypesSubscribeAuthModeTypes