全部产品
Search
文档中心

资源编排:ALIYUN::ECS::ImageSharePermission

更新时间:Jan 18, 2024

ALIYUN::ECS::ImageSharePermission类型用于管理镜像共享权限。

语法

{
  "Type": "ALIYUN::ECS::ImageSharePermission",
  "Properties": {
    "KeepPermission": Boolean,
    "IsPublic": Boolean,
    "ImageId": String,
    "Accounts": List
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

KeepPermission

Boolean

删除资源时是否保留原有的共享权限。

取值:

  • true(默认值):保留原有的共享权限。

  • false:不保留原有的共享权限。

    如果您同时设置了Accounts将被删除。如果设置了IsPublic,IsPublic将被更改。 

IsPublic

Boolean

是否发布或下架社区镜像。

取值:

  • true:发布该镜像为社区镜像。

  • false(默认值):下架该镜像为普通镜像,若该镜像本身是普通镜像,则不做改变 。

ImageId

String

被共享的自定义镜像ID。

Accounts

List

授权共享镜像的阿里云账号ID。

最多支持10个账号,超过10系统会忽略该参数。

返回值

Fn::GetAtt

ImageId:被共享的自定义镜像ID。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      Accounts:
        AssociationProperty: List[Parameter]
        AssociationPropertyMetadata:
          Parameter:
            Description:
              en: Alibaba Cloud account ID authorized to share the image.
            Required: false
            Type: String
        Description:
          en: Alibaba Cloud account IDs authorized to share the image.
        MaxLength: 10
        MinLength: 0
        Required: false
        Type: Json
      ImageId:
        Description:
          en: The shared custom image ID.
        Required: true
        Type: String
      IsPublic:
        Description:
          en: "Whether to publish or remove community mirrors. \nIf this property is not\
            \ set, no changes will be made to the community image"
        Required: false
        Type: Boolean
      KeepPermission:
        Default: true
        Description:
          en: Whether to keep the original sharing permissions when resource is deleted,
            default is true.If set to false, Accounts will be removed if Accounts is set
            and IsPublic will be changed if IsPublic is set.
        Required: false
        Type: Boolean
    Resources:
      ImageSharePermission:
        Properties:
          Accounts:
            Ref: Accounts
          ImageId:
            Ref: ImageId
          IsPublic:
            Ref: IsPublic
          KeepPermission:
            Ref: KeepPermission
        Type: ALIYUN::ECS::ImageSharePermission
    Outputs:
      ImageId:
        Description: The shared custom image ID.
        Value:
          Fn::GetAtt:
          - ImageSharePermission
          - ImageId
                            
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "KeepPermission": {
          "Type": "Boolean",
          "Description": {
            "en": "Whether to keep the original sharing permissions when resource is deleted, default is true.If set to false, Accounts will be removed if Accounts is set and IsPublic will be changed if IsPublic is set."
          },
          "Required": false,
          "Default": true
        },
        "IsPublic": {
          "Type": "Boolean",
          "Description": {
            "en": "Whether to publish or remove community mirrors. \nIf this property is not set, no changes will be made to the community image"
          },
          "Required": false
        },
        "ImageId": {
          "Type": "String",
          "Description": {
            "en": "The shared custom image ID."
          },
          "Required": true
        },
        "Accounts": {
          "AssociationPropertyMetadata": {
            "Parameter": {
              "Type": "String",
              "Description": {
                "en": "Alibaba Cloud account ID authorized to share the image."
              },
              "Required": false
            }
          },
          "AssociationProperty": "List[Parameter]",
          "Type": "Json",
          "Description": {
            "en": "Alibaba Cloud account IDs authorized to share the image."
          },
          "Required": false,
          "MinLength": 0,
          "MaxLength": 10
        }
      },
      "Resources": {
        "ImageSharePermission": {
          "Type": "ALIYUN::ECS::ImageSharePermission",
          "Properties": {
            "KeepPermission": {
              "Ref": "KeepPermission"
            },
            "IsPublic": {
              "Ref": "IsPublic"
            },
            "ImageId": {
              "Ref": "ImageId"
            },
            "Accounts": {
              "Ref": "Accounts"
            }
          }
        }
      },
      "Outputs": {
        "ImageId": {
          "Description": "The shared custom image ID.",
          "Value": {
            "Fn::GetAtt": [
              "ImageSharePermission",
              "ImageId"
            ]
          }
        }
      }
    }