RAM / Client / replace_permission_associations

replace_permission_associations#

RAM.Client.replace_permission_associations(**kwargs)#

Updates all resource shares that use a managed permission to a different managed permission. This operation always applies the default version of the target managed permission. You can optionally specify that the update applies to only resource shares that currently use a specified version. This enables you to update to the latest version, without changing the which managed permission is used.

You can use this operation to update all of your resource shares to use the current default version of the permission by specifying the same value for the fromPermissionArn and toPermissionArn parameters.

You can use the optional fromPermissionVersion parameter to update only those resources that use a specified version of the managed permission to the new managed permission.

Warning

To successfully perform this operation, you must have permission to update the resource-based policy on all affected resource types.

See also: AWS API Documentation

Request Syntax

response = client.replace_permission_associations(
    fromPermissionArn='string',
    fromPermissionVersion=123,
    toPermissionArn='string',
    clientToken='string'
)
Parameters:
  • fromPermissionArn (string) –

    [REQUIRED]

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

  • fromPermissionVersion (integer) – Specifies that you want to updated the permissions for only those resource shares that use the specified version of the managed permission.

  • toPermissionArn (string) –

    [REQUIRED]

    Specifies the ARN of the managed permission that you want to associate with resource shares in place of the one specified by fromPerssionArn and fromPermissionVersion.

    The operation always associates the version that is currently the default for the specified managed permission.

  • clientToken (string) –

    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.

Return type:

dict

Returns:

Response Syntax

{
    'replacePermissionAssociationsWork': {
        'id': 'string',
        'fromPermissionArn': 'string',
        'fromPermissionVersion': 'string',
        'toPermissionArn': 'string',
        'toPermissionVersion': 'string',
        'status': 'IN_PROGRESS'|'COMPLETED'|'FAILED',
        'statusMessage': 'string',
        'creationTime': datetime(2015, 1, 1),
        'lastUpdatedTime': datetime(2015, 1, 1)
    },
    'clientToken': 'string'
}

Response Structure

  • (dict) –

    • replacePermissionAssociationsWork (dict) –

      Specifies a data structure that you can use to track the asynchronous tasks that RAM performs to complete this operation. You can use the ListReplacePermissionAssociationsWork operation and pass the id value returned in this structure.

      • id (string) –

        The unique identifier for the background task associated with one ReplacePermissionAssociations request.

      • fromPermissionArn (string) –

        The Amazon Resource Name (ARN) of the managed permission that this background task is replacing.

      • fromPermissionVersion (string) –

        The version of the managed permission that this background task is replacing.

      • toPermissionArn (string) –

        The ARN of the managed permission that this background task is associating with the resource shares in place of the managed permission and version specified in fromPermissionArn and fromPermissionVersion.

      • toPermissionVersion (string) –

        The version of the managed permission that this background task is associating with the resource shares. This is always the version that is currently the default for this managed permission.

      • status (string) –

        Specifies the current status of the background tasks for the specified ID. The output is one of the following strings:

        • IN_PROGRESS

        • COMPLETED

        • FAILED

      • statusMessage (string) –

        Specifies the reason for a FAILED status. This field is present only when there status is FAILED.

      • creationTime (datetime) –

        The date and time when this asynchronous background task was created.

      • lastUpdatedTime (datetime) –

        The date and time when the status of this background task was last updated.

    • clientToken (string) –

      The idempotency identifier associated with this request. If you want to repeat the same operation in an idempotent manner then you must include this value in the clientToken request parameter of that later call. All other parameters must also have the same values that you used in the first call.

Exceptions

  • RAM.Client.exceptions.MalformedArnException

  • RAM.Client.exceptions.InvalidParameterException

  • RAM.Client.exceptions.ServerInternalException

  • RAM.Client.exceptions.ServiceUnavailableException

  • RAM.Client.exceptions.OperationNotPermittedException

  • RAM.Client.exceptions.UnknownResourceException

  • RAM.Client.exceptions.InvalidClientTokenException

  • RAM.Client.exceptions.IdempotentParameterMismatchException