You need to enable JavaScript to run this app.
文档中心
资源管理

资源管理

复制全文
下载 pdf
共享单元
CreateResourceShare - 创建共享单元
复制全文
下载 pdf
CreateResourceShare - 创建共享单元

创建共享单元

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

CreateResourceShare

要执行的操作,取值:CreateResourceShare。

Version
String

2024-01-01

API的版本,取值:2024-01-01。

Tags.N.Key
Array of String

test-key

标签键

Tags.N.Value
Array of String

test-value

标签值

Name
String

sharexxx

共享单元名称

AllowShareType
String

ANY

共享单元类型,可传值 ORG - 仅允许组织内部共享;ANY - 允许任意账号共享2。默认ANY

Principals
Array of String

2000000001,trn:organization::2000000000:organization/74399781619,trn:organization::2000000000:ou/74734524402

关联的Principals列表(principal是指被共享方,用户、组织或者组织单元)

ResourceTrns
Array of String

trn:vpc:cn-beijing:2000000000:subnet/subnet-rr10x57crloqp,trn:vpc:cn-beijing:2000000000:subnet/subnet-rr1ldklj8d

关联的资源列表

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
ResourceShareTrn
String

trn:resource_share:cn-beijing:2100066160:resource_share/rs-024f008217ec44ed9

共享单元Trn

请求示例

GET /?Action=CreateResourceShare&Version=2024-01-01&Name=sharexxxname&AllowShareType=ANY&Principals.1=2000000001&ResourceTrns.1=trn:vpc:cn-beijing:200000000:subnet/subnet-rr1wh***loqp
 HTTP/1.1
Host: resource-share.volcengineapi.com
X-Date: 20250225T055744Z
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20250225/cn-beijing/resource_share/request, SignedHeaders=host;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f

返回示例

{
  "ResponseMetadata": {
    "RequestId": "202509162148191980400480816FA68A",
    "Action": "CreateResourceShare",
    "Version": "2024-01-01",
    "Service": "resource_share",
    "Region": "cn-beijing"
  },
  "Result": {
    "ResourceShareTrn": "trn:resource_share:cn-beijing:2100066160:resource_share/rs-024f008217ec44ed9\n"
  }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

状态码
错误码
错误信息
说明
400
InvalidParameter

Parameter [%s] is invalid, error: %v

无效的参数,具体无效的参数在会在Error Message中给出

400
MissingParameter

Required parameter[%v] is not found

参数缺失,具体缺失的参数在会在Error Message中给出

400
ShareInvitationQuotaExceeded

the quota of invitaiton has been exceeded

共享邀请数量超出quota限制

400
ShareResourceQuotaExceeded

the quota of resource association has been exceeded

共享单元关联的资源数量超出quota限制

400
ShareQuotaExceeded

the quota of resource-share has been exceeded

共享单元数量超出quota限制

400
SharePrincipalQuotaExceeded

the quota of principal association has been exceeded

共享单元关联的Principal数量超出quota限制(principal是指被共享方,用户、组织或者组织单元)

400
InvalidResourceShare

the status of resource-share[%v] is not ACTIVE

无效的共享单元,共享单元不存在或已被删除

400
NoAvailablePermission

no available permission for resource-type[%v], please create a permission first

当前资源未绑定任何权限策略,请联系相关管理员进行处理

400
RegionNotSupport

the region is not support

不支持的region

400
InvalidResourceType

resource-type[%v] is not supported to be shared

资源类型不支持被共享

400
MalformedResourceTrn

resource trn[%v] is malformed

非法的ResourceTrn参数

400
DuplicatedInvitation

invitation for principal[%v] already exist in resource-share[%v]

共享邀请已存在

400
DuplicatedPermissionAssociation

permission[%v] already associated in resource-share[%v]

共享单元权限策略已关联

400
DuplicatedAssociation

association entity[%v] already exist in resource-share[%v]

实体关联关系已存在

400
ResourceShareExternalNotSupport

resource[%v] is not supported to be shared with external account[%v]

由于系统设定,对应的资源不支持共享给外部账号

400
PrincipalConflict

principal[%v] has already been shared in resource-share[%v]

principal已被关联(principal是指被共享方,用户、组织或者组织单元)

400
ResourceConflict

resource[%v] has already been shared in resource-share[%v]

资源已被共享

400
ShareWithoutOrganization

you are not in any organization so you cannot share resources with [%v]

当前账号不在任何组织,无法发起组织类型的共享

400
InvalidOrganizationUnit

organization unit[%v] is invalid

无效的组织单元,传入的是一个不存在的组织单元

400
InvalidOrganization

organization[%v] is invalid

无效的组织,传入的是一个不存在的组织

400
ShareExternalConflict

external account[%v] is not allowed to be shared in resource-share[%v]

共享单元设置了仅组织内部共享,因此不允许共享给外部账号

400
ShareSelfNotSupport

you cannot share resource to yourself

不支持将资源共享自己

400
RegionConflict

resource[%v] and resource-share[%v] is not in the same region

资源与共享单元的Region不一致

404
PermissionNotFound

permission of resource-type[%v] not found, need to associate a permission for the resource-type first

找不到对应的权限策略,请确认传入的策略Trn是否正确

404
ResourceNotFound

resource[%v] not found

找不到资源,资源Trn对应的账号与当前共享发起者对应不上,简而言之,共享发起者找不到对应资源

500
InternalError

Something went wrong in internal service, please try again later

服务内部系统错误,往往是由服务内部组件异常、网络异常或服务自身bug导致,请及时联系相关管理员进行排查确认

最近更新时间:2025.12.26 18:05:39
这个页面对您有帮助吗?
有用
有用
无用
无用