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

Defines an AWS Elemental MediaPackage V2 Origin Endpoint.

Extends: Construct › Resource › OriginEndpoint
Implements: IOriginEndpoint, IResource, IEnvironmentAware, IOriginEndpointRef, IConstruct, IDependable

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

## Example

```ts
declare const channel: Channel;
declare const spekeRole: iam.IRole;

new OriginEndpoint(this, 'TsEndpoint', {
  channel,
  segment: Segment.ts({
    encryption: TsEncryption.speke({
      method: TsEncryptionMethod.SAMPLE_AES,
      resourceId: 'my-content-id',
      url: 'https://example.com/speke',
      role: spekeRole,
    }),
  }),
  manifests: [Manifest.hls({ manifestName: 'index' })],
});
```

## Initializer

```ts
new OriginEndpoint(scope: Construct, id: string, props: OriginEndpointProps)
```

## Construct Props

- `cdnAuth`: [CdnAuthConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.CdnAuthConfiguration.html) — Provide access to MediaPackage V2 Origin Endpoint via secret header.

  **Default:** undefined - Not configured on endpoint

  Use this when your CDN doesn't support AWS Signature Version 4 (SigV4)
  authentication. For SigV4-based access with Amazon CloudFront, see
  `MediaPackageV2Origin`.

  Setting `cdnAuth` auto-creates the following policy on the OriginEndpoint:

  ```json
  {
    "Version":"2012-10-17",
    "Statement": [
      {
        "Sid": "AllowGetObjectAccessForAuthorizedRequest",
        "Effect": "Allow",
        "Principal": "*",
        "Action": "mediapackagev2:GetObject",
        "Resource": "arn:aws:mediapackagev2:us-east-1:111122223333:channelGroup/channelGroupName/channel/channelName/originEndpoint/originEndpointName",
        "Condition": {
          "Bool": {
            "mediapackagev2:RequestHasMatchingCdnAuthHeader": "true"
          }
        }
      }
    ]
  }
  ```

- `channel`: [IChannel](/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.IChannel.html) (required) — The channel associated with the origin endpoint.

- `description`: string — The description associated with the origin endpoint.

  **Default:** undefined - No description is added to Origin Endpoint

- `forceEndpointConfigurationConditions`: [EndpointErrorConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.EndpointErrorConfiguration.html)[] — The failover settings for the endpoint.

  **Default:** undefined - No force endpoint configuration is configured

- `manifests`: [Manifest](/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.Manifest.html)[] (required) — Manifests configuration for HLS, Low Latency HLS and DASH.

- `originEndpointName`: string = autogenerated — The name of the origin endpoint associated with the origin endpoint configuration.

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

- `segment`: [SegmentConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.SegmentConfiguration.html) (required) — The segment associated with the origin endpoint.

  Inside the segment configuration you can define options such as encryption, SPEKE parameters and other
  general segment configurations.

  Use Segment.ts() or Segment.cmaf() to create the configuration.

- `startoverWindow`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = 900 — The size of the window to specify a window of the live stream that's available for on-demand viewing.

  Viewers can start-over or catch-up on content that falls within the window.

- `tags`: { [key: string]: string } — The tags associated with the origin endpoint.

  **Default:** No tagging

## Properties

- `channelGroupName`: string — The name of the channel group associated with the origin endpoint configuration.

- `channelName`: string — The channel name associated with the origin endpoint.

- `createdAt`: string — The timestamp of the creation of the origin endpoint.

- `dashManifestUrls`: string[] — Array containing DASH Manifests created by the OriginEndpoint.

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

- `hlsManifestUrls`: string[] — Array containing HLS Manifests created by the OriginEndpoint.

- `lowLatencyHlsManifestUrls`: string[] — Array containing Low Latency HLS Manifests created by the OriginEndpoint.

- `modifiedAt`: string — The timestamp of the modification of the origin endpoint.

- `mssManifestUrls`: string[] — Array containing MSS Manifests created by the OriginEndpoint.

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

- `originEndpointArn`: string — The Amazon Resource Name (ARN) of the origin endpoint.

- `originEndpointName`: string — The name of the origin endpoint associated with the origin endpoint configuration.

- `originEndpointRef`: [OriginEndpointReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_mediapackagev2.OriginEndpointReference.html) — A reference to this Origin Endpoint resource.

  Required by the auto-generated IOriginEndpointRef interface.

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

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

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

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

  You can only add 1 OriginEndpointPolicy to an OriginEndpoint. If you have already
  defined one, this will append to the policy already created.

  To configure CDN authentication, set `cdnAuth` on the construct's props instead.

  **Parameters**

  - `statement` — - The policy statement to add.

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

- `fromOriginEndpointArn(scope: Construct, id: string, originEndpointArn: string): IOriginEndpoint` (static) — Creates an OriginEndpoint construct that represents an external (imported) Origin Endpoint from its ARN.

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

- `fromOriginEndpointAttributes(scope: Construct, id: string, attrs: OriginEndpointAttributes): IOriginEndpoint` (static) — Creates an OriginEndpoint construct that represents an external (imported) Origin Endpoint.

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