Skip to content
v2.277.0

ChannelNamespaceOptions Struct ​

Option configuration for channel namespace.

Example ​

ts
declare const api: appsync.EventApi;
declare const ddbDataSource: appsync.AppSyncDynamoDbDataSource;
declare const ebDataSource: appsync.AppSyncEventBridgeDataSource;

// DynamoDB data source for publish handler
api.addChannelNamespace('ddb-eb-ns', {
  code: appsync.Code.fromInline('/* event handler code here.*/'),
  publishHandlerConfig: {
    dataSource: ddbDataSource,
  },
  subscribeHandlerConfig: {
    dataSource: ebDataSource,
  },
});
python
# api: appsync.EventApi
# ddb_data_source: appsync.AppSyncDynamoDbDataSource
# eb_data_source: appsync.AppSyncEventBridgeDataSource


# DynamoDB data source for publish handler
api.add_channel_namespace("ddb-eb-ns",
    code=appsync.Code.from_inline("/* event handler code here.*/"),
    publish_handler_config=appsync.HandlerConfig(
        data_source=ddb_data_source
    ),
    subscribe_handler_config=appsync.HandlerConfig(
        data_source=eb_data_source
    )
)
java
EventApi api;
AppSyncDynamoDbDataSource ddbDataSource;
AppSyncEventBridgeDataSource ebDataSource;


// DynamoDB data source for publish handler
api.addChannelNamespace("ddb-eb-ns", ChannelNamespaceOptions.builder()
        .code(Code.fromInline("/* event handler code here.*/"))
        .publishHandlerConfig(HandlerConfig.builder()
                .dataSource(ddbDataSource)
                .build())
        .subscribeHandlerConfig(HandlerConfig.builder()
                .dataSource(ebDataSource)
                .build())
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
EventApi api;
AppSyncDynamoDbDataSource ddbDataSource;
AppSyncEventBridgeDataSource ebDataSource;


// DynamoDB data source for publish handler
api.AddChannelNamespace("ddb-eb-ns", new ChannelNamespaceOptions {
    Code = Code.FromInline("/* event handler code here.*/"),
    PublishHandlerConfig = new HandlerConfig {
        DataSource = ddbDataSource
    },
    SubscribeHandlerConfig = new HandlerConfig {
        DataSource = ebDataSource
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var api EventApi
var ddbDataSource AppSyncDynamoDbDataSource
var ebDataSource AppSyncEventBridgeDataSource


// DynamoDB data source for publish handler
api.AddChannelNamespace(jsii.String("ddb-eb-ns"), &ChannelNamespaceOptions{
	Code: appsync.Code_FromInline(jsii.String("/* event handler code here.*/")),
	PublishHandlerConfig: &HandlerConfig{
		DataSource: ddbDataSource,
	},
	SubscribeHandlerConfig: &HandlerConfig{
		DataSource: ebDataSource,
	},
})

Properties ​

authorizationConfigoptionalNamespaceAuthConfigauthorization_configoptionalNamespaceAuthConfigauthorizationConfigoptionalNamespaceAuthConfigAuthorizationConfigoptionalNamespaceAuthConfigAuthorizationConfigoptionalNamespaceAuthConfig #
Authorization config for channel namespace.

Default: defaults to Event API default auth config

channelNamespaceNameoptionalstringchannel_namespace_nameoptionalstrchannelNamespaceNameoptionalStringChannelNamespaceNameoptionalstringChannelNamespaceNameoptional*string #
The Channel Namespace name.

Default: the construct's id will be used

codeoptionalCodecodeoptionalCodecodeoptionalCodeCodeoptionalCodeCodeoptionalCode #
The Event Handler code.

Default: no code is used

publishHandlerConfigoptionalHandlerConfigpublish_handler_configoptionalHandlerConfigpublishHandlerConfigoptionalHandlerConfigPublishHandlerConfigoptionalHandlerConfigPublishHandlerConfigoptionalHandlerConfig #
onPublish handler config.

Default: no handler config

subscribeHandlerConfigoptionalHandlerConfigsubscribe_handler_configoptionalHandlerConfigsubscribeHandlerConfigoptionalHandlerConfigSubscribeHandlerConfigoptionalHandlerConfigSubscribeHandlerConfigoptionalHandlerConfig #
onSubscribe handler config.

Default: no handler config