Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::ResourceManager::ResourceShareAssociation

Última atualização: Jun 27, 2026

Associa um recurso compartilhado ou um usuário de recurso a um compartilhamento de recursos.

Sintaxe

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

Propriedades

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

ResourceShareId

String

Sim

Não

ID do compartilhamento de recursos.

Nenhuma.

Targets

List

Não

Sim

ID da entidade principal.

Valores válidos:

  • Se AllowExternalTargets estiver definido como false no compartilhamento de recursos, apenas o compartilhamento dentro de um diretório de recursos terá suporte. Defina esta propriedade como o ID do diretório de recursos, uma pasta no diretório de recursos ou um membro do diretório de recursos.

  • Caso AllowExternalTargets esteja definido como true no compartilhamento de recursos, haverá suporte para compartilhamento interno e externo ao diretório de recursos. Defina esta propriedade como o ID de uma conta independente da Alibaba Cloud, o diretório de recursos, uma pasta no diretório de recursos ou um membro do diretório de recursos.

Nota

Especifique até cinco IDs de entidades principais.

Resources

List

Não

Sim

Recursos.

Especifique até cinco recursos. Para mais informações, consulte Propriedades de Resources.

PermissionNames

List

Não

Não

Nome da permissão.

Se você não especificar um nome, o sistema atribuirá automaticamente a permissão padrão associada ao tipo de recurso. Para mais informações, consulte Permissões para compartilhamento de recursos. Especifique até cinco nomes.

Sintaxe de Resources

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

Propriedades de Resources

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

ResourceId

String

Sim

Sim

ID do recurso compartilhado.

Especifique até cinco IDs por vez.

ResourceType

String

Sim

Sim

Tipo do recurso compartilhado.

Especifique até cinco recursos compartilhados por vez. Para obter mais informações sobre os tipos de recursos compartilháveis, consulte Serviços com suporte no Resource Sharing.

Nota

Se você especificar ResourceType, também deverá especificar ResourceId.

Valores de retorno

Fn::GetAtt

ResourceShareId: o ID do compartilhamento de recursos.

Exemplos

  • YAML formato

    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 formato

    {
      "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"
            ]
          }
        }
      }
    }