# BaseChannelNamespaceProps

the base properties for a channel namespace.

- Source: [`aws-appsync/lib/channel-namespace.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-appsync/lib/channel-namespace.ts#L92)
- Type last changed: v2.193.0 · 30 Apr 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';

declare const appSyncBackedDataSource: appsync.AppSyncBackedDataSource;
declare const code: appsync.Code;
const baseChannelNamespaceProps: appsync.BaseChannelNamespaceProps = {
  authorizationConfig: {
    publishAuthModeTypes: [appsync.AppSyncAuthorizationType.API_KEY],
    subscribeAuthModeTypes: [appsync.AppSyncAuthorizationType.API_KEY],
  },
  channelNamespaceName: 'channelNamespaceName',
  code: code,
  publishHandlerConfig: {
    dataSource: appSyncBackedDataSource,
    direct: false,
    lambdaInvokeType: appsync.LambdaInvokeType.EVENT,
  },
  subscribeHandlerConfig: {
    dataSource: appSyncBackedDataSource,
    direct: false,
    lambdaInvokeType: appsync.LambdaInvokeType.EVENT,
  },
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appsync as appsync

# app_sync_backed_data_source: appsync.AppSyncBackedDataSource
# code: appsync.Code

base_channel_namespace_props = appsync.BaseChannelNamespaceProps(
    authorization_config=appsync.NamespaceAuthConfig(
        publish_auth_mode_types=[appsync.AppSyncAuthorizationType.API_KEY],
        subscribe_auth_mode_types=[appsync.AppSyncAuthorizationType.API_KEY]
    ),
    channel_namespace_name="channelNamespaceName",
    code=code,
    publish_handler_config=appsync.HandlerConfig(
        data_source=app_sync_backed_data_source,
        direct=False,
        lambda_invoke_type=appsync.LambdaInvokeType.EVENT
    ),
    subscribe_handler_config=appsync.HandlerConfig(
        data_source=app_sync_backed_data_source,
        direct=False,
        lambda_invoke_type=appsync.LambdaInvokeType.EVENT
    )
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appsync.*;

AppSyncBackedDataSource appSyncBackedDataSource;
Code code;

BaseChannelNamespaceProps baseChannelNamespaceProps = BaseChannelNamespaceProps.builder()
        .authorizationConfig(NamespaceAuthConfig.builder()
                .publishAuthModeTypes(List.of(AppSyncAuthorizationType.API_KEY))
                .subscribeAuthModeTypes(List.of(AppSyncAuthorizationType.API_KEY))
                .build())
        .channelNamespaceName("channelNamespaceName")
        .code(code)
        .publishHandlerConfig(HandlerConfig.builder()
                .dataSource(appSyncBackedDataSource)
                .direct(false)
                .lambdaInvokeType(LambdaInvokeType.EVENT)
                .build())
        .subscribeHandlerConfig(HandlerConfig.builder()
                .dataSource(appSyncBackedDataSource)
                .direct(false)
                .lambdaInvokeType(LambdaInvokeType.EVENT)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppSync;

AppSyncBackedDataSource appSyncBackedDataSource;
Code code;

var baseChannelNamespaceProps = new BaseChannelNamespaceProps {
    AuthorizationConfig = new NamespaceAuthConfig {
        PublishAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY },
        SubscribeAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY }
    },
    ChannelNamespaceName = "channelNamespaceName",
    Code = code,
    PublishHandlerConfig = new HandlerConfig {
        DataSource = appSyncBackedDataSource,
        Direct = false,
        LambdaInvokeType = LambdaInvokeType.EVENT
    },
    SubscribeHandlerConfig = new HandlerConfig {
        DataSource = appSyncBackedDataSource,
        Direct = false,
        LambdaInvokeType = LambdaInvokeType.EVENT
    }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var appSyncBackedDataSource AppSyncBackedDataSource
var code Code

baseChannelNamespaceProps := &BaseChannelNamespaceProps{
	AuthorizationConfig: &NamespaceAuthConfig{
		PublishAuthModeTypes: []AppSyncAuthorizationType{
			awscdk.Aws_appsync.AppSyncAuthorizationType_API_KEY,
		},
		SubscribeAuthModeTypes: []AppSyncAuthorizationType{
			awscdk.*Aws_appsync.AppSyncAuthorizationType_API_KEY,
		},
	},
	ChannelNamespaceName: jsii.String("channelNamespaceName"),
	Code: code,
	PublishHandlerConfig: &HandlerConfig{
		DataSource: appSyncBackedDataSource,
		Direct: jsii.Boolean(false),
		LambdaInvokeType: awscdk.*Aws_appsync.LambdaInvokeType_EVENT,
	},
	SubscribeHandlerConfig: &HandlerConfig{
		DataSource: appSyncBackedDataSource,
		Direct: jsii.Boolean(false),
		LambdaInvokeType: awscdk.*Aws_appsync.LambdaInvokeType_EVENT,
	},
}
```

## Properties

- `authorizationConfig`: [NamespaceAuthConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.NamespaceAuthConfig.html) — Authorization config for channel namespace.

  **Default:** defaults to Event API default auth config

- `channelNamespaceName`: string — the name of the channel namespace.

  **Default:** the construct's id will be used

- `code`: [Code](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.Code.html) — The Event Handler code.

  **Default:** no code is used

- `publishHandlerConfig`: [HandlerConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.HandlerConfig.html) — onPublish handler config.

  **Default:** no handler config

- `subscribeHandlerConfig`: [HandlerConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.HandlerConfig.html) — onSubscribe handler config.

  **Default:** no handler config
