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

Defines an AWS Elemental MediaPackage V2 Channel Group.

Extends: Construct › Resource › ChannelGroup
Implements: IChannelGroup, IResource, IEnvironmentAware, IChannelGroupRef, IConstruct, IDependable

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

## Example

```ts
declare const stack: Stack;

// Create a channel group
const group = new ChannelGroup(stack, 'MyChannelGroup', {
  channelGroupName: 'my-channel-group',
});

// Add a channel using the factory method
const channel = group.addChannel('MyChannel', {
  channelName: 'my-channel',
  input: InputConfiguration.cmaf(),
});

// Add an origin endpoint using the factory method
const endpoint = channel.addOriginEndpoint('MyEndpoint', {
  originEndpointName: 'my-endpoint',
  segment: Segment.cmaf(),
  manifests: [Manifest.hls({ manifestName: 'index' })],
});
```

## Initializer

```ts
new ChannelGroup(scope: Construct, id: string, props?: ChannelGroupProps)
```

## Construct Props

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

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

- `description`: string — The description for your channel group.

  **Default:** no description

- `removalPolicy`: [RemovalPolicy](/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) = RemovalPolicy.DESTROY — Policy to apply when the channel group 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 Group.

  **Default:** No tagging

## Properties

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

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

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

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

  Required by the auto-generated IChannelGroupRef interface.

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

- `egressDomain`: string — The egress domain where packaged content is available.

  Use this as the origin domain when configuring a CDN such as Amazon CloudFront.

- `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.

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

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

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

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

## Methods

- `addChannel(id: string, options?: ChannelOptions): Channel` — Add Channel for this Channel Group.

- `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`).

- `fromChannelGroupArn(scope: Construct, id: string, channelGroupArn: string): IChannelGroup` (static) — Creates a Channel Group construct that represents an external (imported) Channel Group from its ARN.

- `fromChannelGroupAttributes(scope: Construct, id: string, attrs: ChannelGroupAttributes): IChannelGroup` (static) — Creates a Channel Group construct that represents an external (imported) Channel Group.

- `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, props?: MetricOptions): Metric` — Create a CloudWatch metric.

  **Parameters**

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

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

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

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

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

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

- `metricIngressResponseTime(props?: 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.
