All Products
Search
Document Center

Resource Management:AcceptResourceShareInvitation

Last Updated:Mar 22, 2024

Accepts a resource sharing invitation.

Operation description

  • A principal needs to accept or reject a resource sharing invitation only if the principal is not the management account or a member of a resource directory. If you share resources with an object in a resource directory, the system automatically accepts the resource sharing invitation for the object.
  • A resource sharing invitation is valid for seven days. A principal must accept or reject the invitation within the validity period.

This topic provides an example on how to call the API operation to accept the resource sharing invitation whose ID is i-pMnItMX19fBJ**** in the cn-hangzhou region.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
resourcesharing:AcceptResourceShareInvitationWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceShareInvitationIdstringYes

The ID of the resource sharing invitation.

You can call the ListResourceShareInvitations operation to obtain the ID.

i-pMnItMX19fBJ****

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object

The returned results.

RequestIdstring

The request ID.

08F18B04-47CB-5C0E-A6D2-37DEF5C2A961
ResourceShareInvitationobject

The information about the resource sharing invitation.

ResourceShareInvitationIdstring

The ID of the resource sharing invitation.

i-pMnItMX19fBJ****
ResourceShareIdstring

The ID of the resource share.

rs-ysGRci9z****
ResourceShareNamestring

The name of the resource share.

example
SenderAccountIdstring

The Alibaba Cloud account ID of the inviter.

151266687691****
ReceiverAccountIdstring

The Alibaba Cloud account ID of the invitee.

134254031178****
CreateTimestring

The time when the invitation was created. The time is displayed in UTC.

2022-09-02T06:43:12.353Z
Statusstring

The status of the invitation. Valid values:

  • Pending
  • Accepted
  • Cancelled
  • Rejected
  • Expired
  • AcceptFailed
AcceptFailed
AcceptInvitationFailedDetailsobject []

The information about the failure.

Statusstring

The failure status. Valid values:

  • Unavailable: The resource cannot be shared.
  • LimitExceeded: The number of shared resources within the Alibaba Cloud account exceeds the upper limit.
  • ZonalResourceInaccessible: The resource is unavailable in this region.
  • InternalError: An internal error occurred during the check.
Unavailable
StatusMessagestring

The failure cause.

You cannot access the specified resource at this time.
AssociateTypestring

The type of the sharing operation. Valid values:

  • Associate
Associate
ResourceIdstring

The ID of the shared resource.

s-7xvh46nx5oqlre0wv***
ResourceTypestring

The type of the shared resource.

For more information about the types of resources that can be shared, see Services that work with Resource Sharing.

Snapshot

Examples

Sample success responses

JSONformat

{
  "RequestId": "08F18B04-47CB-5C0E-A6D2-37DEF5C2A961",
  "ResourceShareInvitation": {
    "ResourceShareInvitationId": "i-pMnItMX19fBJ****",
    "ResourceShareId": "rs-ysGRci9z****",
    "ResourceShareName": "example",
    "SenderAccountId": "151266687691****",
    "ReceiverAccountId": "134254031178****",
    "CreateTime": "2022-09-02T06:43:12.353Z",
    "Status": "AcceptFailed",
    "AcceptInvitationFailedDetails": [
      {
        "Status": "Unavailable",
        "StatusMessage": "You cannot access the specified resource at this time.",
        "AssociateType": "Associate",
        "ResourceId": "s-7xvh46nx5oqlre0wv***",
        "ResourceType": "Snapshot"
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter.ResourceShareInvitationIdThe ResourceShareInvitationId is invalid.The invitation ID is invalid.
400MissingParameter.ResourceShareInvitationIdYou must specify ResourceShareInvitationId.You must specify an invitation ID.
409InvitationStatus.ExpiredThe resource share invitation status is expired.The invitation has expired.
409EntityNotExists.ResourceShareInvitationThe resource share invitation does not exist in the current account.The invitation does not exist.
409InvitationStatus.AlreadyRejectedThe resource share invitation status is rejected.The invitation has been rejected.
409InvitationStatus.AlreadyAcceptedThe resource share invitation status is alredy accepted.The invitation has been accepted.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-02-04The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 409
Output ParametersThe response structure of the API has changed.
2023-12-25The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 409
Output ParametersThe response structure of the API has changed.