全部產品
Search
文件中心

:ALIYUN::ResourceManager::ResourceShare

更新時間:Jun 19, 2024

ALIYUN::ResourceManager::ResourceShare類型用於建立共用單元。

文法

{
  "Type": "ALIYUN::ResourceManager::ResourceShare",
  "Properties": {
    "ResourceShareName": String,
    "Targets": List,
    "Resources": List,
    "AllowExternalTargets": Boolean,
    "PermissionNames": List
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

ResourceShareName

String

共用單元名稱。

長度為1~50個字元。可包含英文字母、數字、漢字、半形句號(.)、底線(_)和短劃線(-)。

Targets

List

資源使用者。

資源共用的受益方,可以使用共用的資源,通常為資來源目錄內的成員帳號UID。關於如何擷取成員帳號UID,請參見查看成員詳情

取值範圍:1~5,即每次最多添加5個資源使用者。

Resources

List

共用資源。

取值範圍:1~5,即每次最多添加5個共用資源。

更多資訊,請參見Resources屬性

AllowExternalTargets

Boolean

是否允許資來源目錄外的賬戶共用。

取值:

  • true:允許共用到任何賬戶。

  • false(預設值):只允許在資來源目錄內共用。

PermissionNames

List

共用許可權名稱。

當為空白時,系統自動綁定與該資源類型關聯的預設許可權。 

Resources文法

"Resources": [
  {
    "ResourceId": String,
    "ResourceType": String
  }
]

Resources屬性

屬性名稱

類型

必須

允許更新

描述

約束

ResourceId

String

共用資源ID。

取值樣本:vsw-bp183p93qs667muql****

ResourceType

String

共用資源類型。

取值:vSwitch。

傳回值

Fn::GetAtt

ResourceShareId:共用單元ID。

樣本

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ResourceShareName:
    AllowedPattern: '[-a-zA-Z0-9_\.]{1,50}'
    Description: 'The name of the resource share.

      The name must be 1 to 50 characters in length.

      It can contain letters, digits, periods (.), underscores (_), and hyphens (-).'
    Type: String
  Resources:
    Description: ''
    MaxLength: 5
    Type: Json
  Targets:
    Description: 'The shared target.

      A shared target shares the resources of resource owners. You can share your
      resources

      only with the member accounts in your resource directory. A shared target is
      indicated

      by its account ID. For more information about how to obtain the ID, see View
      the basic information of a member account.'
    MaxLength: 5
    Type: Json
Resources:
  ResourceShare:
    Properties:
      ResourceShareName:
        Ref: ResourceShareName
      Resources:
        Ref: Resources
      Targets:
        Ref: Targets
    Type: ALIYUN::ResourceManager::ResourceShare
Outputs:
  ResourceShareId:
    Description: The ID of the resource share.
    Value:
      Fn::GetAtt:
      - ResourceShare
      - ResourceShareId

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ResourceShareName": {
      "Type": "String",
      "Description": "The name of the resource share.\nThe name must be 1 to 50 characters in length.\nIt can contain letters, digits, periods (.), underscores (_), and hyphens (-).",
      "AllowedPattern": "[-a-zA-Z0-9_\\.]{1,50}"
    },
    "Targets": {
      "Type": "Json",
      "Description": "The shared target.\nA shared target shares the resources of resource owners. You can share your resources\nonly with the member accounts in your resource directory. A shared target is indicated\nby its account ID. For more information about how to obtain the ID, see View the basic information of a member account.",
      "MaxLength": 5
    },
    "Resources": {
      "Type": "Json",
      "Description": "",
      "MaxLength": 5
    }
  },
  "Resources": {
    "ResourceShare": {
      "Type": "ALIYUN::ResourceManager::ResourceShare",
      "Properties": {
        "ResourceShareName": {
          "Ref": "ResourceShareName"
        },
        "Targets": {
          "Ref": "Targets"
        },
        "Resources": {
          "Ref": "Resources"
        }
      }
    }
  },
  "Outputs": {
    "ResourceShareId": {
      "Description": "The ID of the resource share.",
      "Value": {
        "Fn::GetAtt": [
          "ResourceShare",
          "ResourceShareId"
        ]
      }
    }
  }
}