Skip to content

put_channel_policy async

put_channel_policy(
    channel_name: __string,
    policy: __string,
    *,
    config_overrides: Optional[AsyncMediaTailorClientConfig] = None,
) -> PutChannelPolicyResponse

Creates an IAM policy for the channel. IAM policies are used to control access to your channel.

Parameters:

  • channel_name (__string) –

    The channel name associated with this Channel Policy.

  • policy (__string) –

    Adds an IAM role that determines the permissions of your channel.

Raises:

Source code in docs_src/capo_mediatailor/_services/async_media_tailor.py
async def put_channel_policy(
    self,
    channel_name: "capo_mediatailor.types.__string.__string",
    policy: "capo_mediatailor.types.__string.__string",
    *,
    config_overrides: Optional[AsyncMediaTailorClientConfig] = None,
) -> "capo_mediatailor.types.put_channel_policy_response.PutChannelPolicyResponse":
    """<p>Creates an IAM policy for the channel. IAM policies are used to control access to your channel.</p>

    Args:
        channel_name: <p>The channel name associated with this Channel Policy.</p>
        policy: <p>Adds an IAM role that determines the permissions of your channel.</p>

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

    async def _handler(
        req: "AsyncOperationRequest[capo_mediatailor.types.put_channel_policy_request.PutChannelPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_mediatailor.types.put_channel_policy_response.PutChannelPolicyResponse"
    ]:
        import capo_mediatailor._operations.media_tailor.put_channel_policy

        (
            output,
            http_response,
        ) = await capo_mediatailor._operations.media_tailor.put_channel_policy.async_put_channel_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutChannelPolicy")
    )
    input_: capo_mediatailor.types.put_channel_policy_request.PutChannelPolicyRequest = {
        "channel_name": channel_name,
        "policy": policy,
    }

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