DATASOURCE::CR::Instance类型用于查询实例信息。
语法
{
  "Type": "DATASOURCE::CR::Instance",
  "Properties": {
    "InstanceId": String,
    "RefreshOptions": String
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| InstanceId | String | 是 | 是 | 实例ID。 | 无 | 
| RefreshOptions | String | 否 | 是 | 当资源栈更新时,数据源资源的刷新策略。 | 取值: 
 | 
返回值
Fn::GetAtt
- InstanceName:实例名称。 
- ModifiedTime:最近修改时间。 
- ResourceGroupId:资源组ID。 
- InstanceId:实例ID。 
- InstanceSpecification:企业版规格。 
- CreateTime:创建时间。 
示例
YAML格式
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  InstanceId:
    Description:
      en: The first ID of the resource.
    Required: true
    Type: String
Resources:
  ExtensionDataSource:
    Properties:
      InstanceId:
        Ref: InstanceId
    Type: DATASOURCE::CR::Instance
Outputs:
  CreateTime:
    Description: The creation time of the resource.
    Value:
      Fn::GetAtt:
      - ExtensionDataSource
      - CreateTime
  InstanceId:
    Description: The first ID of the resource.
    Value:
      Fn::GetAtt:
      - ExtensionDataSource
      - InstanceId
  InstanceName:
    Description: InstanceName.
    Value:
      Fn::GetAtt:
      - ExtensionDataSource
      - InstanceName
  InstanceSpecification:
    Description: InstanceSpecification.
    Value:
      Fn::GetAtt:
      - ExtensionDataSource
      - InstanceSpecification
  ModifiedTime:
    Description: Last modification time.
    Value:
      Fn::GetAtt:
      - ExtensionDataSource
      - ModifiedTime
  ResourceGroupId:
    Description: The ID of the resource group.
    Value:
      Fn::GetAtt:
      - ExtensionDataSource
      - ResourceGroupId
                        JSON格式
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "InstanceId": {
      "Type": "String",
      "Description": {
        "en": "The first ID of the resource."
      },
      "Required": true
    }
  },
  "Resources": {
    "ExtensionDataSource": {
      "Type": "DATASOURCE::CR::Instance",
      "Properties": {
        "InstanceId": {
          "Ref": "InstanceId"
        }
      }
    }
  },
  "Outputs": {
    "InstanceName": {
      "Description": "InstanceName.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "InstanceName"
        ]
      }
    },
    "ModifiedTime": {
      "Description": "Last modification time.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "ModifiedTime"
        ]
      }
    },
    "ResourceGroupId": {
      "Description": "The ID of the resource group.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "ResourceGroupId"
        ]
      }
    },
    "InstanceId": {
      "Description": "The first ID of the resource.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "InstanceId"
        ]
      }
    },
    "InstanceSpecification": {
      "Description": "InstanceSpecification.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "InstanceSpecification"
        ]
      }
    },
    "CreateTime": {
      "Description": "The creation time of the resource.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "CreateTime"
        ]
      }
    }
  }
}
                        该文章对您有帮助吗?