Skip to content

create_channel async

create_channel(
    channel_group_name: ResourceName,
    channel_name: ResourceName,
    *,
    config_overrides: Optional[AsyncMediaPackageV2ClientConfig] = None,
    client_token: Optional[IdempotencyToken] = None,
    input_type: Optional[InputType] = None,
    description: Optional[ResourceDescription] = None,
    input_switch_configuration: Optional[InputSwitchConfiguration] = None,
    output_header_configuration: Optional[OutputHeaderConfiguration] = None,
    multiview_configuration: Optional[MultiviewConfiguration] = None,
    output_locking_mode: Optional[OutputLockingMode] = None,
    tags: Optional[TagMap] = None,
) -> CreateChannelResponse

Create a channel to start receiving content streams. The channel represents the input to MediaPackage for incoming live content from an encoder such as AWS Elemental MediaLive. The channel receives content, and after packaging it, outputs it through an origin endpoint to downstream devices (such as video players or CDNs) that request the content. You can create only one channel with each request. We recommend that you spread out channels between channel groups, such as putting redundant channels in the same AWS Region in different channel groups.

Parameters:

  • channel_group_name (ResourceName) –

    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.

  • channel_name (ResourceName) –

    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. You can't change the name after you create the channel.

  • client_token (Optional[IdempotencyToken], default: None ) –

    A unique, case-sensitive token that you provide to ensure the idempotency of the request.

  • input_type (Optional[InputType], default: None ) –

    The input type is an immutable field. It defines whether the channel allows CMAF ingest, HLS ingest, or server-side multiview output. Multiview channels receive no ingest of their own. If unprovided, the value defaults to HLS.

    The allowed values are:

    • HLS - The HLS streaming specification (which defines M3U8 manifests and TS segments).

    • CMAF - The DASH-IF CMAF Ingest specification (which defines CMAF segments with optional DASH manifests).

    • MULTIVIEW – Server-side multiview. The channel receives no ingest of its own. Instead, it composites video from the source channels in its MultiviewConfiguration into a single tiled output stream.

  • description (Optional[ResourceDescription], default: None ) –

    Enter any descriptive text that helps you to identify the channel.

  • input_switch_configuration (Optional[InputSwitchConfiguration], default: None ) –

    The configuration for input switching based on the media quality confidence score (MQCS) as provided from AWS Elemental MediaLive. This setting is valid only when InputType is CMAF.

  • output_header_configuration (Optional[OutputHeaderConfiguration], default: None ) –

    The settings for what common media server data (CMSD) headers AWS Elemental MediaPackage includes in responses to the CDN. This setting is valid only when InputType is CMAF.

  • multiview_configuration (Optional[MultiviewConfiguration], default: None ) –

    The multiview configuration for the channel. This setting is required when InputType is MULTIVIEW, and can't be set for any other input type.

  • output_locking_mode (Optional[OutputLockingMode], default: None ) –

    The output locking mode for the channel. This setting is only valid when InputType is CMAF. This value is immutable after channel creation. If you don't specify a value, the default is EPOCH_LOCKED.

    The allowed values are:

    • EPOCH_LOCKED - The channel uses epoch-locked behavior with deterministic sequence numbering and fixed segment boundaries aligned to epoch time. This mode supports cross-region synchronization and failover.

    • NON_EPOCH_LOCKED - The channel uses non-epoch-locked behavior with duration-based segment combining and monotonically increasing sequence numbers starting from 0. This mode does not support cross-region synchronization or failover.

  • tags (Optional[TagMap], default: None ) –

    A comma-separated list of tag key:value pairs that you define. For example:

    "Key1": "Value1",

    "Key2": "Value2"

Raises:

  • AccessDeniedException –

    Access is denied because either you don't have permissions to perform the requested operation or MediaPackage is getting throttling errors with CDN authorization. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management in the IAM User Guide. Or, if you're using CDN authorization, you will receive this exception if MediaPackage receives a throttling error from Secrets Manager.

  • ConflictException –

    Updating or deleting this resource can cause an inconsistent state.

  • InternalServerException –

    Indicates that an error from the service occurred while trying to process a request.

  • ResourceNotFoundException –

    The specified resource doesn't exist.

  • ServiceQuotaExceededException –

    The request would cause a service quota to be exceeded.

  • ThrottlingException –

    The request throughput limit was exceeded.

  • ValidationException –

    The input failed to meet the constraints specified by the AWS service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Creating a Channel

>>> await client.create_channel(channel_group_name='exampleChannelGroup', channel_name='exampleChannel', input_type='HLS', description='Description for exampleChannel', tags={'key1': 'value1', 'key2': 'value2'})
Creating a CMAF Channel with non-epoch-locked output locking mode
>>> await client.create_channel(channel_group_name='exampleChannelGroup', channel_name='exampleCmafChannel', input_type='CMAF', output_locking_mode='NON_EPOCH_LOCKED', description='Non-epoch-locked CMAF channel')
Source code in docs_src/capo_mediapackagev2/_services/async_media_package_v2.py
async def create_channel(
    self,
    channel_group_name: "capo_mediapackagev2.types.resource_name.ResourceName",
    channel_name: "capo_mediapackagev2.types.resource_name.ResourceName",
    *,
    config_overrides: Optional[AsyncMediaPackageV2ClientConfig] = None,
    client_token: Optional[
        "capo_mediapackagev2.types.idempotency_token.IdempotencyToken"
    ] = None,
    input_type: Optional["capo_mediapackagev2.types.input_type.InputType"] = None,
    description: Optional[
        "capo_mediapackagev2.types.resource_description.ResourceDescription"
    ] = None,
    input_switch_configuration: Optional[
        "capo_mediapackagev2.types.input_switch_configuration.InputSwitchConfiguration"
    ] = None,
    output_header_configuration: Optional[
        "capo_mediapackagev2.types.output_header_configuration.OutputHeaderConfiguration"
    ] = None,
    multiview_configuration: Optional[
        "capo_mediapackagev2.types.multiview_configuration.MultiviewConfiguration"
    ] = None,
    output_locking_mode: Optional[
        "capo_mediapackagev2.types.output_locking_mode.OutputLockingMode"
    ] = None,
    tags: Optional["capo_mediapackagev2.types.tag_map.TagMap"] = None,
) -> "capo_mediapackagev2.types.create_channel_response.CreateChannelResponse":
    """<p>Create a channel to start receiving content streams. The channel represents the input to MediaPackage for incoming live content from an encoder such as AWS Elemental MediaLive. The channel receives content, and after packaging it, outputs it through an origin endpoint to downstream devices (such as video players or CDNs) that request the content. You can create only one channel with each request. We recommend that you spread out channels between channel groups, such as putting redundant channels in the same AWS Region in different channel groups.</p>

    Args:
        channel_group_name: <p>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.</p>
        channel_name: <p>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. You can't change the name after you create the channel.</p>
        client_token: <p>A unique, case-sensitive token that you provide to ensure the idempotency of the request.</p>
        input_type: <p>The input type is an immutable field. It defines whether the channel allows CMAF ingest, HLS ingest, or server-side multiview output. Multiview channels receive no ingest of their own. If unprovided, the value defaults to HLS.</p> <p>The allowed values are:</p> <ul> <li> <p> <code>HLS</code> - The HLS streaming specification (which defines M3U8 manifests and TS segments).</p> </li> <li> <p> <code>CMAF</code> - The DASH-IF CMAF Ingest specification (which defines CMAF segments with optional DASH manifests).</p> </li> <li> <p> <code>MULTIVIEW</code> – Server-side multiview. The channel receives no ingest of its own. Instead, it composites video from the source channels in its <code>MultiviewConfiguration</code> into a single tiled output stream.</p> </li> </ul>
        description: <p>Enter any descriptive text that helps you to identify the channel.</p>
        input_switch_configuration: <p>The configuration for input switching based on the media quality confidence score (MQCS) as provided from AWS Elemental MediaLive. This setting is valid only when <code>InputType</code> is <code>CMAF</code>.</p>
        output_header_configuration: <p>The settings for what common media server data (CMSD) headers AWS Elemental MediaPackage includes in responses to the CDN. This setting is valid only when <code>InputType</code> is <code>CMAF</code>.</p>
        multiview_configuration: <p>The multiview configuration for the channel. This setting is required when <code>InputType</code> is <code>MULTIVIEW</code>, and can't be set for any other input type.</p>
        output_locking_mode: <p>The output locking mode for the channel. This setting is only valid when <code>InputType</code> is <code>CMAF</code>. This value is immutable after channel creation. If you don't specify a value, the default is <code>EPOCH_LOCKED</code>.</p> <p>The allowed values are:</p> <ul> <li> <p> <code>EPOCH_LOCKED</code> - The channel uses epoch-locked behavior with deterministic sequence numbering and fixed segment boundaries aligned to epoch time. This mode supports cross-region synchronization and failover.</p> </li> <li> <p> <code>NON_EPOCH_LOCKED</code> - The channel uses non-epoch-locked behavior with duration-based segment combining and monotonically increasing sequence numbers starting from 0. This mode does not support cross-region synchronization or failover.</p> </li> </ul>
        tags: <p>A comma-separated list of tag key:value pairs that you define. For example:</p> <p> <code>"Key1": "Value1",</code> </p> <p> <code>"Key2": "Value2"</code> </p>

    Raises:
        capo_mediapackagev2.errors.access_denied_exception.AccessDeniedException: <p>Access is denied because either you don't have permissions to perform the requested operation or MediaPackage is getting throttling errors with CDN authorization. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management in the IAM User Guide. Or, if you're using CDN authorization, you will receive this exception if MediaPackage receives a throttling error from Secrets Manager.</p>
        capo_mediapackagev2.errors.conflict_exception.ConflictException: <p>Updating or deleting this resource can cause an inconsistent state.</p>
        capo_mediapackagev2.errors.internal_server_exception.InternalServerException: <p>Indicates that an error from the service occurred while trying to process a request.</p>
        capo_mediapackagev2.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource doesn't exist.</p>
        capo_mediapackagev2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause a service quota to be exceeded.</p>
        capo_mediapackagev2.errors.throttling_exception.ThrottlingException: <p>The request throughput limit was exceeded.</p>
        capo_mediapackagev2.errors.validation_exception.ValidationException: <p>The input failed to meet the constraints specified by the AWS service.</p>
        capo_mediapackagev2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Creating a Channel

        >>> await client.create_channel(channel_group_name='exampleChannelGroup', channel_name='exampleChannel', input_type='HLS', description='Description for exampleChannel', tags={'key1': 'value1', 'key2': 'value2'})
        Creating a CMAF Channel with non-epoch-locked output locking mode

        >>> await client.create_channel(channel_group_name='exampleChannelGroup', channel_name='exampleCmafChannel', input_type='CMAF', output_locking_mode='NON_EPOCH_LOCKED', description='Non-epoch-locked CMAF channel')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_mediapackagev2.types.create_channel_request.CreateChannelRequest]",
    ) -> AsyncOperationResponse[
        "capo_mediapackagev2.types.create_channel_response.CreateChannelResponse"
    ]:
        import capo_mediapackagev2._operations.mediapackagev2.create_channel

        (
            output,
            http_response,
        ) = await capo_mediapackagev2._operations.mediapackagev2.create_channel.async_create_channel(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateChannel")
    )
    input_: capo_mediapackagev2.types.create_channel_request.CreateChannelRequest = {
        "channel_group_name": channel_group_name,
        "channel_name": channel_name,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if input_type is not None:
        input_["input_type"] = input_type
    if description is not None:
        input_["description"] = description
    if input_switch_configuration is not None:
        input_["input_switch_configuration"] = input_switch_configuration
    if output_header_configuration is not None:
        input_["output_header_configuration"] = output_header_configuration
    if multiview_configuration is not None:
        input_["multiview_configuration"] = multiview_configuration
    if output_locking_mode is not None:
        input_["output_locking_mode"] = output_locking_mode
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output