> **Experimental**
>
> `@aws-cdk/aws-mediapackagev2-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# Channel

Defines an AWS Elemental MediaPackage V2 Channel.

Extends: Construct › Resource › Channel
Implements: IChannel, IResource, IEnvironmentAware, IChannelRef, IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/channel.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0-alpha.0/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/channel.ts#L610)

## Example

```ts
declare const stack: Stack;
const group = new ChannelGroup(stack, 'MyChannelGroup', {
    channelGroupName: 'my-test-channel-group',
});

const channel = new Channel(stack, 'MyChannel', {
    channelGroup: group,
    channelName: 'my-testchannel',
    input: InputConfiguration.cmaf(),
});

const endpoint = new OriginEndpoint(stack, 'MyOriginEndpoint', {
    channel,
    originEndpointName: 'my-test-endpoint',
    segment: Segment.cmaf(),
    manifests: [Manifest.hls({
        manifestName: 'index',
    })],
});
```

## Initializer

```ts
new Channel(scope: Construct, id: string, props: ChannelProps)
```

## Construct Props

- `channelGroup`: [IChannelGroup](/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.IChannelGroup.html) (required) — Channel Group to add this Channel to.

- `channelName`: string = autogenerated — The name that describes the channel.

  The name is the primary identifier for the channel, and must be unique for your account in the AWS Region and channel group.

- `description`: string — Enter any descriptive text that helps you to identify the channel.

  **Default:** no description

- `input`: [InputConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.InputConfiguration.html) = InputConfiguration.cmaf() — Input configuration for the channel.

  Use InputConfiguration.hls() or InputConfiguration.cmaf() to create the configuration.

- `removalPolicy`: [RemovalPolicy](/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) = RemovalPolicy.DESTROY — Policy to apply when the channel is removed from the stack.

  Even though MediaPackage ChannelGroups, Channels and OriginEndpoints are technically stateful,
  their contents are transient and it is common to add and remove these while rearchitecting your application.
  The default is therefore `DESTROY`. Change it to `RETAIN` if the content (in a lookback window) are so
  valuable that accidentally losing it would be unacceptable.

- `tags`: { [key: string]: string } — Tags to add to the Channel.

  **Default:** No tagging

## Properties

- `channelArn`: string — The Amazon Resource Name (ARN) associated with the resource.

- `channelGroup`: [IChannelGroup](/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.IChannelGroup.html) — The channel group this channel belongs to.

  Only available when the channel was created in the same stack.
  Undefined for imported channels.

- `channelGroupName`: string — The name that describes the channel group.

  The name is the primary identifier for the channel group.

- `channelName`: string — The name that describes the channel.

  The name is the primary identifier for the channel.

- `channelRef`: [ChannelReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_mediapackagev2.ChannelReference.html) — A reference to this Channel resource.

- `createdAt`: string — The date and time the channel was created.

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `grants`: [ChannelGrants](/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.ChannelGrants.html) — Collection of grant methods for this channel.

- `ingestEndpointUrls`: string[] — The list of ingest endpoints.

- `modifiedAt`: string — The date and time the channel was modified.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `policy`: [ChannelPolicy](/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.ChannelPolicy.html) — The resource policy associated with this channel.

  If `autoCreatePolicy` is true, a `ChannelPolicy` will be created upon the
  first call to addToResourcePolicy(s).

- `PROPERTY_INJECTION_ID`: string (static) — Uniquely identifies this class.

- `region`: string — The AWS region where this channel lives.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `addOriginEndpoint(id: string, options: OriginEndpointOptions): OriginEndpoint` — Add Origin Endpoint for this Channel.

- `addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult` — Configure channel policy.

  You can only add 1 ChannelPolicy to a Channel.
  If you have already defined one, function will append the policy already created.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `fromChannelArn(scope: Construct, id: string, channelArn: string): IChannel` (static) — Creates a Channel construct that represents an external (imported) Channel from its ARN.

  The ARN is expected to be in the format:
  `arn:<partition>:mediapackagev2:<region>:<account>:channelGroup/<groupName>/channel/<channelName>`

- `fromChannelAttributes(scope: Construct, id: string, attrs: ChannelAttributes): IChannel` (static) — Creates a Channel construct that represents an external (imported) Channel.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `metric(metricName: string, options?: MetricOptions): Metric` — Create a CloudWatch metric.

  **Parameters**

  - `metricName` — name of the metric.
  - `options` — metric options.

- `metricEgressBytes(options?: MetricOptions): Metric` — Returns Metric for Egress Bytes.

- `metricEgressRequestCount(options?: MetricOptions): Metric` — Returns Metric for Egress Request Count.

- `metricEgressResponseTime(options?: MetricOptions): Metric` — Returns Metric for Egress Response time.

- `metricIngressBytes(options?: MetricOptions): Metric` — Returns Metric for Ingress Bytes.

- `metricIngressRequestCount(options?: MetricOptions): Metric` — Returns Metric for Ingress Request Count.

- `metricIngressResponseTime(options?: MetricOptions): Metric` — Returns Metric for Ingress response time.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
