Skip to content

update_permission

update_permission(
    permission_arn: String,
    status: UpdatePermissionStatus,
    *,
    config_overrides: Optional[RAMClientConfig] = None,
    client_token: Optional[String] = None,
) -> UpdatePermissionResponse

Updates the status of the specified customer managed permission.

Setting the status to DEPRECATED prevents new resource share associations. Setting it to ATTACHABLE restores a previously deprecated permission. Existing resource shares that use the permission continue to function.

Parameters:

  • permission_arn (String) –

    Specifies the Amazon Resource Name (ARN) of the customer managed permission that you want to update.

  • status (UpdatePermissionStatus) –

    Specifies the new status for the permission. This can be one of the following values:

    • ATTACHABLE – Restores a previously deprecated permission so it can be associated with resource shares again.

    • DEPRECATED – Deprecates the permission so it can no longer be associated with new resource shares.

  • client_token (Optional[String], default: None ) –

    Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value..

    If you don't provide this value, then Amazon Web Services generates a random one for you.

    If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an IdempotentParameterMismatch error.

Raises:

Examples:

Deprecate a managed permission Deprecates a customer managed permission so it can no longer be associated with new resource shares.

>>> client.update_permission(permission_arn='arn:aws:ram:us-east-1:123456789012:permission/AnyCompanyImageBuilderPermission', status='DEPRECATED')
Source code in docs_src/capo_ram/_services/ram.py
def update_permission(
    self,
    permission_arn: "capo_ram.types.string.String",
    status: "capo_ram.types.update_permission_status.UpdatePermissionStatus",
    *,
    config_overrides: Optional[RAMClientConfig] = None,
    client_token: Optional["capo_ram.types.string.String"] = None,
) -> "capo_ram.types.update_permission_response.UpdatePermissionResponse":
    """<p>Updates the status of the specified customer managed permission.</p> <p>Setting the status to <code>DEPRECATED</code> prevents new resource share associations. Setting it to <code>ATTACHABLE</code> restores a previously deprecated permission. Existing resource shares that use the permission continue to function.</p>

    Args:
        permission_arn: <p>Specifies the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the customer managed permission that you want to update.</p>
        status: <p>Specifies the new status for the permission. This can be one of the following values:</p> <ul> <li> <p> <code>ATTACHABLE</code> – Restores a previously deprecated permission so it can be associated with resource shares again.</p> </li> <li> <p> <code>DEPRECATED</code> – Deprecates the permission so it can no longer be associated with new resource shares.</p> </li> </ul>
        client_token: <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p> <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p> <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>

    Raises:
        capo_ram.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>The operation failed because the client token input parameter matched one that was used with a previous call to the operation, but at least one of the other input parameters is different from the previous call.</p>
        capo_ram.errors.invalid_client_token_exception.InvalidClientTokenException: <p>The operation failed because the specified client token isn't valid.</p>
        capo_ram.errors.invalid_parameter_exception.InvalidParameterException: <p>The operation failed because a parameter you specified isn't valid.</p>
        capo_ram.errors.malformed_arn_exception.MalformedArnException: <p>The operation failed because the specified <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> has a format that isn't valid.</p>
        capo_ram.errors.operation_not_permitted_exception.OperationNotPermittedException: <p>The operation failed because the requested operation isn't permitted.</p>
        capo_ram.errors.permission_limit_exceeded_exception.PermissionLimitExceededException: <p>The operation failed because it would exceed the maximum number of permissions you can create in each Amazon Web Services Region. To view the limits for your Amazon Web Services account, see the <a href="https://console.aws.amazon.com/servicequotas/home/services/ram/quotas">RAM page in the Service Quotas console</a>.</p>
        capo_ram.errors.server_internal_exception.ServerInternalException: <p>The operation failed because the service could not respond to the request due to an internal problem. Try again later.</p>
        capo_ram.errors.service_unavailable_exception.ServiceUnavailableException: <p>The operation failed because the service isn't available. Try again later.</p>
        capo_ram.errors.unknown_resource_exception.UnknownResourceException: <p>The operation failed because a specified resource couldn't be found.</p>
        capo_ram.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Deprecate a managed permission
        Deprecates a customer managed permission so it can no longer be associated with new resource shares.

        >>> client.update_permission(permission_arn='arn:aws:ram:us-east-1:123456789012:permission/AnyCompanyImageBuilderPermission', status='DEPRECATED')
    """

    def _handler(
        req: "OperationRequest[capo_ram.types.update_permission_request.UpdatePermissionRequest]",
    ) -> OperationResponse[
        "capo_ram.types.update_permission_response.UpdatePermissionResponse"
    ]:
        import capo_ram._operations.amazon_resource_sharing.update_permission

        output, http_response = (
            capo_ram._operations.amazon_resource_sharing.update_permission.update_permission(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePermission")
    )
    input_: capo_ram.types.update_permission_request.UpdatePermissionRequest = {
        "permission_arn": permission_arn,
        "status": status,
    }
    if client_token is not None:
        input_["client_token"] = client_token

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