創(chuàng)建共享單元。
接口說明
阿里云資源共享(Resource Sharing)支持將一個賬號下的指定資源共享給一個或多個目標(biāo)賬號使用。更多信息,請參見資源共享概述。
本文將提供一個示例,在cn-hangzhou
地域,使用資源目錄管理賬號創(chuàng)建一個名為test
的共享單元,將 VPC 交換機vsw-bp183p93qs667muql****
共享給資源目錄內(nèi)的成員172050525300****
。
調(diào)試
您可以在OpenAPI Explorer中直接運行該接口,免去您計算簽名的困擾。運行成功后,OpenAPI Explorer可以自動生成SDK代碼示例。
授權(quán)信息
下表是API對應(yīng)的授權(quán)信息,可以在RAM權(quán)限策略語句的Action
元素中使用,用來給RAM用戶或RAM角色授予調(diào)用此API的權(quán)限。具體說明如下:
- 操作:是指具體的權(quán)限點。
- 訪問級別:是指每個操作的訪問級別,取值為寫入(Write)、讀?。≧ead)或列出(List)。
- 資源類型:是指操作中支持授權(quán)的資源類型。具體說明如下:
- 對于必選的資源類型,用背景高亮的方式表示。
- 對于不支持資源級授權(quán)的操作,用
全部資源
表示。
- 條件關(guān)鍵字:是指云產(chǎn)品自身定義的條件關(guān)鍵字。
- 關(guān)聯(lián)操作:是指成功執(zhí)行操作所需要的其他權(quán)限。操作者必須同時具備關(guān)聯(lián)操作的權(quán)限,操作才能成功。
操作 | 訪問級別 | 資源類型 | 條件關(guān)鍵字 | 關(guān)聯(lián)操作 |
---|---|---|---|---|
|
| 無 |
請求參數(shù)
名稱 | 類型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
ResourceShareName | string | 是 | 共享單元名稱。 長度范圍:1~50 個字符。 格式:允許輸入英文字母、數(shù)字、中文、半角句號(.)、下劃線(_)或短劃線(-)。 | test |
Resources | object [] | 否 | 共享資源列表。 | |
ResourceType | string | 否 | 共享資源類型。 N 的取值范圍:1~5,即每次最多添加 5 個共享資源。 支持共享的資源類型,請參見支持資源共享的云服務(wù)。 說明
Resources.N.ResourceId 與Resources.N.ResourceType 成對出現(xiàn),需要同時設(shè)置。
| VSwitch |
ResourceId | string | 否 | 共享資源 ID。 N 的取值范圍:1~5,即每次最多添加 5 個共享資源。 說明
Resources.N.ResourceId 與Resources.N.ResourceType 成對出現(xiàn),需要同時設(shè)置。
| vsw-bp183p93qs667muql**** |
Targets | array | 否 | 資源使用者。 | |
string | 否 | 172050525300**** | ||
PermissionNames | array | 否 | 共享權(quán)限名稱。為空時,系統(tǒng)自動綁定資源類型關(guān)聯(lián)的默認權(quán)限。具體信息,請參見權(quán)限庫。 | |
string | 否 | 共享權(quán)限名稱。為空時,系統(tǒng)自動綁定資源類型關(guān)聯(lián)的默認權(quán)限。具體信息,請參見權(quán)限庫。 | AliyunRSDefaultPermissionVSwitch | |
AllowExternalTargets | boolean | 否 | 是否允許共享給資源目錄外的賬號。取值:
| false |
TargetProperties | object [] | 否 | 資源使用者屬性。 說明
僅當(dāng)資源使用者為阿里云服務(wù)時可以設(shè)置該參數(shù)。
| |
TargetId | string | 否 | 資源使用者 ID。 說明
TargetProperties.N.TargetId 與TargetProperties.N.Property 成對出現(xiàn),需要同時設(shè)置。
| 172050525300**** |
Property | string | 否 | 資源使用者屬性參數(shù)。例如:您可以設(shè)置資源共享的時間段。
說明
TargetProperties.N.TargetId 與TargetProperties.N.Property 成對出現(xiàn),需要同時設(shè)置。
| { "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } |
返回參數(shù)
示例
正常返回示例
JSON
格式
{
"RequestId": "2C3FA051-61DC-4F3E-81E9-E4830524DF4B",
"ResourceShare": {
"UpdateTime": "2020-12-03T08:02:22.413Z",
"ResourceShareName": "test",
"ResourceShareOwner": "151266687691****",
"CreateTime": "2020-12-03T08:02:22.413Z",
"ResourceShareId": "rs-qSkW1HBY****",
"ResourceShareStatus": "Active",
"AllowExternalTargets": false
}
}
錯誤碼
HTTP status code | 錯誤碼 | 錯誤信息 | 描述 |
---|---|---|---|
共享單元名稱無效。 | |||
共享單元名稱字數(shù)超長(最大50字符)。 | |||
選定的共享資源無效。 | |||
選定的共享資源有重復(fù)項。 | |||
選定的共享資源數(shù)量超限(最大5個)。 | |||
資源使用者的參數(shù)不符合規(guī)則。 | |||
資源使用者有重復(fù)項。 | |||
資源使用者數(shù)量超限(最大5個)。 | |||
資源使用者不在資源目錄內(nèi)。 | |||
參數(shù)無效。 | |||
共享單元名稱缺失。 | |||
傳入的資源類型錯誤。 | |||
參數(shù)PermissionNames重復(fù)。 | |||
PermissionNames長度超限。 | |||
TargetProperties參數(shù)無效。 | |||
TargetProperties包含重復(fù)的參數(shù)。 | |||
TargetProperties數(shù)量超過限制。 | |||
共享權(quán)限不存在。 | |||
未開啟與資源目錄組織的共享。 | |||
資源使用者不在資源目錄內(nèi)。 | |||
共享單元數(shù)量超出限制。 | |||
共享單元ID已存在。 | |||
共享的資源超出單個賬號最大限制。 | |||
資源使用者不能是自己。 | |||
當(dāng)前資源類型僅支持資源目錄的管理賬號共享資源。如仍需使用當(dāng)前賬號,請聯(lián)系管理賬號將當(dāng)前賬號設(shè)置為當(dāng)前資源類型所屬可信服務(wù)的委派管理員賬號。 | |||
邀請數(shù)量超出限制。 | |||
共享目標(biāo)賬號的企業(yè)名稱與共享者不一致。 | |||
共享單元中包含不支持組織外共享的資源類型。 | |||
共享目標(biāo)賬號與共享者站點不一致。 | |||
此資源類型已經(jīng)通過其他共享單元共享給目標(biāo)云服務(wù),請在同一個共享單元中共享。 | |||
同一個資源不允許重復(fù)共享給目標(biāo)云服務(wù)。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
變更時間 | 變更內(nèi)容概要 | 操作 | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
看變更集 | ||||||||||||||||
| ||||||||||||||||
看變更集 | ||||||||||||||||
| ||||||||||||||||
看變更集 | ||||||||||||||||
| ||||||||||||||||
看變更集 | ||||||||||||||||
| ||||||||||||||||
看變更集 | ||||||||||||||||
| ||||||||||||||||
看變更集 | ||||||||||||||||
|