Skip to content

create_prefetch_schedule

create_prefetch_schedule(
    name: __string,
    playback_configuration_name: __string,
    *,
    config_overrides: Optional[MediaTailorClientConfig] = None,
    consumption: Optional[PrefetchConsumption] = None,
    retrieval: Optional[PrefetchRetrieval] = None,
    recurring_prefetch_configuration: Optional[RecurringPrefetchConfiguration] = None,
    schedule_type: Optional[PrefetchScheduleType] = None,
    stream_id: Optional[__string] = None,
    tags: Optional[__mapOf__string] = None,
) -> CreatePrefetchScheduleResponse

Creates a prefetch schedule for a playback configuration. A prefetch schedule allows you to tell MediaTailor to fetch and prepare certain ads before an ad break happens. For more information about ad prefetching, see Using ad prefetching in the MediaTailor User Guide.

Parameters:

  • consumption (Optional[PrefetchConsumption], default: None ) –

    The configuration settings for how and when MediaTailor consumes prefetched ads from the ad decision server for single prefetch schedules. Each consumption configuration contains an end time and an optional start time that define the consumption window. Prefetch schedules automatically expire no earlier than seven days after the end time.

  • name (__string) –

    The name to assign to the schedule request.

  • playback_configuration_name (__string) –

    The name to assign to the playback configuration.

  • retrieval (Optional[PrefetchRetrieval], default: None ) –

    The configuration settings for retrieval of prefetched ads from the ad decision server. Only one set of prefetched ads will be retrieved and subsequently consumed for each ad break.

  • recurring_prefetch_configuration (Optional[RecurringPrefetchConfiguration], default: None ) –

    The configuration that defines how and when MediaTailor performs ad prefetching in a live event.

  • schedule_type (Optional[PrefetchScheduleType], default: None ) –

    The frequency that MediaTailor creates prefetch schedules. SINGLE indicates that this schedule applies to one ad break. RECURRING indicates that MediaTailor automatically creates a schedule for each ad avail in a live event.

    For more information about the prefetch types and when you might use each, see Prefetching ads in Elemental MediaTailor.

  • stream_id (Optional[__string], default: None ) –

    An optional stream identifier that MediaTailor uses to prefetch ads for multiple streams that use the same playback configuration. If StreamId is specified, MediaTailor returns all of the prefetch schedules with an exact match on StreamId. If not specified, MediaTailor returns all of the prefetch schedules for the playback configuration, regardless of StreamId.

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

    The tags to assign to the prefetch schedule. Tags are key-value pairs that you can associate with Amazon resources to help with organization, access control, and cost tracking. For more information, see Tagging AWS Elemental MediaTailor Resources.

Raises:

Source code in docs_src/capo_mediatailor/_services/media_tailor.py
def create_prefetch_schedule(
    self,
    name: "capo_mediatailor.types.__string.__string",
    playback_configuration_name: "capo_mediatailor.types.__string.__string",
    *,
    config_overrides: Optional[MediaTailorClientConfig] = None,
    consumption: Optional[
        "capo_mediatailor.types.prefetch_consumption.PrefetchConsumption"
    ] = None,
    retrieval: Optional[
        "capo_mediatailor.types.prefetch_retrieval.PrefetchRetrieval"
    ] = None,
    recurring_prefetch_configuration: Optional[
        "capo_mediatailor.types.recurring_prefetch_configuration.RecurringPrefetchConfiguration"
    ] = None,
    schedule_type: Optional[
        "capo_mediatailor.types.prefetch_schedule_type.PrefetchScheduleType"
    ] = None,
    stream_id: Optional["capo_mediatailor.types.__string.__string"] = None,
    tags: Optional[
        "capo_mediatailor.types.__map_of__string.__mapOf__string"
    ] = None,
) -> "capo_mediatailor.types.create_prefetch_schedule_response.CreatePrefetchScheduleResponse":
    """<p>Creates a prefetch schedule for a playback configuration. A prefetch schedule allows you to tell MediaTailor to fetch and prepare certain ads before an ad break happens. For more information about ad prefetching, see <a href="https://docs.aws.amazon.com/mediatailor/latest/ug/prefetching-ads.html">Using ad prefetching</a> in the <i>MediaTailor User Guide</i>.</p>

    Args:
        consumption: <p>The configuration settings for how and when MediaTailor consumes prefetched ads from the ad decision server for single prefetch schedules. Each consumption configuration contains an end time and an optional start time that define the <i>consumption window</i>. Prefetch schedules automatically expire no earlier than seven days after the end time.</p>
        name: <p>The name to assign to the schedule request.</p>
        playback_configuration_name: <p>The name to assign to the playback configuration.</p>
        retrieval: <p>The configuration settings for retrieval of prefetched ads from the ad decision server. Only one set of prefetched ads will be retrieved and subsequently consumed for each ad break.</p>
        recurring_prefetch_configuration: <p>The configuration that defines how and when MediaTailor performs ad prefetching in a live event.</p>
        schedule_type: <p>The frequency that MediaTailor creates prefetch schedules. <code>SINGLE</code> indicates that this schedule applies to one ad break. <code>RECURRING</code> indicates that MediaTailor automatically creates a schedule for each ad avail in a live event.</p> <p>For more information about the prefetch types and when you might use each, see <a href="https://docs.aws.amazon.com/mediatailor/latest/ug/prefetching-ads.html">Prefetching ads in Elemental MediaTailor.</a> </p>
        stream_id: <p>An optional stream identifier that MediaTailor uses to prefetch ads for multiple streams that use the same playback configuration. If <code>StreamId</code> is specified, MediaTailor returns all of the prefetch schedules with an exact match on <code>StreamId</code>. If not specified, MediaTailor returns all of the prefetch schedules for the playback configuration, regardless of <code>StreamId</code>.</p>
        tags: <p>The tags to assign to the prefetch schedule. Tags are key-value pairs that you can associate with Amazon resources to help with organization, access control, and cost tracking. For more information, see <a href="https://docs.aws.amazon.com/mediatailor/latest/ug/tagging.html">Tagging AWS Elemental MediaTailor Resources</a>.</p>

    Raises:
        capo_mediatailor.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_mediatailor.types.create_prefetch_schedule_request.CreatePrefetchScheduleRequest]",
    ) -> OperationResponse[
        "capo_mediatailor.types.create_prefetch_schedule_response.CreatePrefetchScheduleResponse"
    ]:
        import capo_mediatailor._operations.media_tailor.create_prefetch_schedule

        output, http_response = (
            capo_mediatailor._operations.media_tailor.create_prefetch_schedule.create_prefetch_schedule(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreatePrefetchSchedule")
    )
    input_: capo_mediatailor.types.create_prefetch_schedule_request.CreatePrefetchScheduleRequest = {
        "name": name,
        "playback_configuration_name": playback_configuration_name,
    }
    if consumption is not None:
        input_["consumption"] = consumption
    if retrieval is not None:
        input_["retrieval"] = retrieval
    if recurring_prefetch_configuration is not None:
        input_["recurring_prefetch_configuration"] = (
            recurring_prefetch_configuration
        )
    if schedule_type is not None:
        input_["schedule_type"] = schedule_type
    if stream_id is not None:
        input_["stream_id"] = stream_id
    if tags is not None:
        input_["tags"] = tags

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