Skip to content

insert_ad_break

insert_ad_break(
    channel_arn: ChannelArn,
    duration_seconds: AdDurationSeconds,
    *,
    config_overrides: Optional[ivsClientConfig] = None,
) -> InsertAdBreakResponse

Inserts an ad marker in the playlist for the specified channel and duration using the ad configuration associated with the channel.

Note: AWS Elemental MediaTailor (EMT), the service that handles ad requests, provides CloudWatch metrics to help you monitor the success or failure of each InsertAdBreak operation. See Monitoring AWS Elemental MediaTailor with Amazon CloudWatch metrics in the AWS Elemental MediaTailor User Guide for details on available metrics.

Parameters:

  • channel_arn (ChannelArn) –

    ARN of the channel into which the ad break is inserted.

  • duration_seconds (AdDurationSeconds) –

    Duration of the ad break, in seconds.

Raises:

Source code in docs_src/capo_ivs/_services/ivs.py
def insert_ad_break(
    self,
    channel_arn: "capo_ivs.types.channel_arn.ChannelArn",
    duration_seconds: "capo_ivs.types.ad_duration_seconds.AdDurationSeconds",
    *,
    config_overrides: Optional[ivsClientConfig] = None,
) -> "capo_ivs.types.insert_ad_break_response.InsertAdBreakResponse":
    """<p>Inserts an ad marker in the playlist for the specified channel and duration using the ad configuration associated with the channel.</p> <p> <b>Note:</b> AWS Elemental MediaTailor (EMT), the service that handles ad requests, provides CloudWatch metrics to help you monitor the success or failure of each InsertAdBreak operation. See <a href="https://docs.aws.amazon.com/mediatailor/latest/ug/monitoring-cloudwatch-metrics.html">Monitoring AWS Elemental MediaTailor with Amazon CloudWatch</a> metrics in the <i>AWS Elemental MediaTailor User Guide</i> for details on available metrics.</p>

    Args:
        channel_arn: <p>ARN of the channel into which the ad break is inserted.</p>
        duration_seconds: <p>Duration of the ad break, in seconds.</p>

    Raises:
        capo_ivs.errors.access_denied_exception.AccessDeniedException: <p>User does not have sufficient access to perform this action.</p>
        capo_ivs.errors.channel_not_broadcasting.ChannelNotBroadcasting: <p>The stream is offline for the given channel ARN.</p>
        capo_ivs.errors.conflict_exception.ConflictException: <p>Updating or deleting a resource can cause an inconsistent state.</p>
        capo_ivs.errors.internal_server_exception.InternalServerException: <p>Unexpected error during processing of request.</p>
        capo_ivs.errors.resource_not_found_exception.ResourceNotFoundException: <p>Request references a resource which does not exist.</p>
        capo_ivs.errors.throttling_exception.ThrottlingException: <p>Request was denied due to request throttling.</p>
        capo_ivs.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_ivs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ivs.types.insert_ad_break_request.InsertAdBreakRequest]",
    ) -> OperationResponse[
        "capo_ivs.types.insert_ad_break_response.InsertAdBreakResponse"
    ]:
        import capo_ivs._operations.amazon_interactive_video_service.insert_ad_break

        output, http_response = (
            capo_ivs._operations.amazon_interactive_video_service.insert_ad_break.insert_ad_break(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("InsertAdBreak")
    )
    input_: capo_ivs.types.insert_ad_break_request.InsertAdBreakRequest = {
        "channel_arn": channel_arn,
        "duration_seconds": duration_seconds,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output