Skip to content

put_channel_policy

put_channel_policy(
    channel_name: __string,
    policy: __string,
    *,
    config_overrides: Optional[MediaTailorClientConfig] = 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/media_tailor.py
def put_channel_policy(
    self,
    channel_name: "capo_mediatailor.types.__string.__string",
    policy: "capo_mediatailor.types.__string.__string",
    *,
    config_overrides: Optional[MediaTailorClientConfig] = 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.
    """

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

        output, http_response = (
            capo_mediatailor._operations.media_tailor.put_channel_policy.put_channel_policy(
                req.options, req.input
            )
        )
        return OperationResponse(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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output