Skip to content

put_origin_endpoint_policy async

put_origin_endpoint_policy(
    channel_group_name: ResourceName,
    channel_name: ResourceName,
    origin_endpoint_name: ResourceName,
    policy: PolicyText,
    *,
    config_overrides: Optional[AsyncMediaPackageV2ClientConfig] = None,
    cdn_auth_configuration: Optional[CdnAuthConfiguration] = None,
) -> PutOriginEndpointPolicyResponse

Attaches an IAM policy to the specified origin endpoint. You can attach only one policy with each request.

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.

  • origin_endpoint_name (ResourceName) –

    The name that describes the origin endpoint. The name is the primary identifier for the origin endpoint, and and must be unique for your account in the AWS Region and channel.

  • policy (PolicyText) –

    The policy to attach to the specified origin endpoint.

  • cdn_auth_configuration (Optional[CdnAuthConfiguration], default: None ) –

    The settings for using authorization headers between the MediaPackage endpoint and your CDN.

    For information about CDN authorization, see CDN authorization in Elemental MediaPackage in the MediaPackage user guide.

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.

  • 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 an Origin Endpoint Policy

>>> await client.put_origin_endpoint_policy(channel_group_name='exampleChannelGroup', channel_name='exampleChannel', origin_endpoint_name='exampleOriginEndpoint', policy='{...}')
Source code in docs_src/capo_mediapackagev2/_services/async_media_package_v2.py
async def put_origin_endpoint_policy(
    self,
    channel_group_name: "capo_mediapackagev2.types.resource_name.ResourceName",
    channel_name: "capo_mediapackagev2.types.resource_name.ResourceName",
    origin_endpoint_name: "capo_mediapackagev2.types.resource_name.ResourceName",
    policy: "capo_mediapackagev2.types.policy_text.PolicyText",
    *,
    config_overrides: Optional[AsyncMediaPackageV2ClientConfig] = None,
    cdn_auth_configuration: Optional[
        "capo_mediapackagev2.types.cdn_auth_configuration.CdnAuthConfiguration"
    ] = None,
) -> "capo_mediapackagev2.types.put_origin_endpoint_policy_response.PutOriginEndpointPolicyResponse":
    """<p>Attaches an IAM policy to the specified origin endpoint. You can attach only one policy with each request.</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. </p>
        origin_endpoint_name: <p>The name that describes the origin endpoint. The name is the primary identifier for the origin endpoint, and and must be unique for your account in the AWS Region and channel. </p>
        policy: <p>The policy to attach to the specified origin endpoint.</p>
        cdn_auth_configuration: <p>The settings for using authorization headers between the MediaPackage endpoint and your CDN. </p> <p>For information about CDN authorization, see <a href="https://docs.aws.amazon.com/mediapackage/latest/userguide/cdn-auth.html">CDN authorization in Elemental MediaPackage</a> in the MediaPackage user guide. </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.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 an Origin Endpoint Policy

        >>> await client.put_origin_endpoint_policy(channel_group_name='exampleChannelGroup', channel_name='exampleChannel', origin_endpoint_name='exampleOriginEndpoint', policy='{...}')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_mediapackagev2.types.put_origin_endpoint_policy_request.PutOriginEndpointPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_mediapackagev2.types.put_origin_endpoint_policy_response.PutOriginEndpointPolicyResponse"
    ]:
        import capo_mediapackagev2._operations.mediapackagev2.put_origin_endpoint_policy

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutOriginEndpointPolicy")
    )
    input_: capo_mediapackagev2.types.put_origin_endpoint_policy_request.PutOriginEndpointPolicyRequest = {
        "channel_group_name": channel_group_name,
        "channel_name": channel_name,
        "origin_endpoint_name": origin_endpoint_name,
        "policy": policy,
    }
    if cdn_auth_configuration is not None:
        input_["cdn_auth_configuration"] = cdn_auth_configuration

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