全部产品
Search
文档中心

资源编排:ALIYUN::ResourceManager::ResourceShareAssociation

更新时间:Nov 23, 2023

ALIYUN::ResourceManager::ResourceShareAssociation类型用于关联共享资源或资源使用者。

语法

{
  "Type": "ALIYUN::ResourceManager::ResourceShareAssociation",
  "Properties": {
    "ResourceShareId": String,
    "Targets": List,
    "Resources": List,
    "PermissionNames": List
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

ResourceShareId

String

共享单元ID。

Targets

List

资源使用者。

取值:

  • AllowExternalTargetsfalse时,即仅允许资源目录内共享时,资源使用者可以为资源目录ID、资源夹ID或成员ID。

  • AllowExternalTargetstrue时,即允许共享给任意账号时,资源使用者可以为阿里云账号ID、资源目录ID、资源夹ID或成员ID。

说明

每次最多添加5个资源使用者。

Resources

List

资源列表。

最多添加5个。更多信息,请参见Resources属性

PermissionNames

List

共享权限名称。

不输入共享权限名称时,系统自动绑定资源类型关联的默认权限。更多信息,请参见资源共享权限。最多添加5个。

Resources语法

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

Resources属性

属性名称

类型

必须

允许更新

描述

约束

ResourceId

String

共享资源ID。

每次最多添加5个共享资源。

ResourceType

String

共享资源类型。

每次最多添加5个共享资源。支持共享的资源类型,请参见支持资源共享的云服务

说明

ResourceType和ResourceId需要同时设置。

返回值

Fn::GetAtt

ResourceShareId:共享单元ID。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      PermissionNames:
        AssociationProperty: List[Parameter]
        AssociationPropertyMetadata:
          Parameter:
            Type: String
        Description:
          en: Sharing permission name. When empty, the system automatically binds the
            default permissions associated with the resource type.
        MaxLength: 6
        Type: Json
      ResourceShareId:
        Description:
          en: The ID of the resource share.
        Type: String
      Resources:
        AssociationProperty: List[Parameter]
        AssociationPropertyMetadata:
          Parameter:
            AssociationPropertyMetadata:
              Parameters:
                ResourceId:
                  Description:
                    en: The ID of the shared resource.
                  Type: String
                ResourceType:
                  Description:
                    en: 'The type of the shared resource.
    
                      Support resource type include:
    
                      VPC: VSwitch, PrefixList, PublicIpAddressPool
    
                      ROS: ROSTemplate
    
                      ServiceCatalog: ServiceCatalogPortfolio
    
                      ECS: Image, Snapshot
    
                      KMS: KMSInstance'
                  Type: String
            Type: Json
        MaxLength: 5
        Type: Json
      Targets:
        AssociationProperty: List[Parameter]
        AssociationPropertyMetadata:
          Parameter:
            Type: String
        Description:
          en: '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:
      ResourceShareAssociation:
        Properties:
          PermissionNames:
            Ref: PermissionNames
          ResourceShareId:
            Ref: ResourceShareId
          Resources:
            Ref: Resources
          Targets:
            Ref: Targets
        Type: ALIYUN::ResourceManager::ResourceShareAssociation
    Outputs:
      ResourceShareId:
        Description: The ID of the resource share.
        Value:
          Fn::GetAtt:
          - ResourceShareAssociation
          - ResourceShareId
                            
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "ResourceShareId": {
          "Type": "String",
          "Description": {
            "en": "The ID of the resource share."
          }
        },
        "Targets": {
          "AssociationPropertyMetadata": {
            "Parameter": {
              "Type": "String"
            }
          },
          "AssociationProperty": "List[Parameter]",
          "Type": "Json",
          "Description": {
            "en": "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": {
          "AssociationPropertyMetadata": {
            "Parameter": {
              "AssociationPropertyMetadata": {
                "Parameters": {
                  "ResourceId": {
                    "Type": "String",
                    "Description": {
                      "en": "The ID of the shared resource."
                    }
                  },
                  "ResourceType": {
                    "Type": "String",
                    "Description": {
                      "en": "The type of the shared resource.\nSupport resource type include:\nVPC: VSwitch, PrefixList, PublicIpAddressPool\nROS: ROSTemplate\nServiceCatalog: ServiceCatalogPortfolio\nECS: Image, Snapshot\nKMS: KMSInstance"
                    }
                  }
                }
              },
              "Type": "Json"
            }
          },
          "AssociationProperty": "List[Parameter]",
          "Type": "Json",
          "MaxLength": 5
        },
        "PermissionNames": {
          "AssociationPropertyMetadata": {
            "Parameter": {
              "Type": "String"
            }
          },
          "AssociationProperty": "List[Parameter]",
          "Type": "Json",
          "Description": {
            "en": "Sharing permission name. When empty, the system automatically binds the default permissions associated with the resource type."
          },
          "MaxLength": 6
        }
      },
      "Resources": {
        "ResourceShareAssociation": {
          "Type": "ALIYUN::ResourceManager::ResourceShareAssociation",
          "Properties": {
            "ResourceShareId": {
              "Ref": "ResourceShareId"
            },
            "Targets": {
              "Ref": "Targets"
            },
            "Resources": {
              "Ref": "Resources"
            },
            "PermissionNames": {
              "Ref": "PermissionNames"
            }
          }
        }
      },
      "Outputs": {
        "ResourceShareId": {
          "Description": "The ID of the resource share.",
          "Value": {
            "Fn::GetAtt": [
              "ResourceShareAssociation",
              "ResourceShareId"
            ]
          }
        }
      }
    }