All Products
Search
Document Center

Resource Orchestration Service:DATASOURCE::ECS::KeyPair

Last Updated:Nov 26, 2024

DATASOURCE::ECS::KeyPair is used to query the information about a key pair.

Syntax

{
  "Type": "DATASOURCE::ECS::KeyPair",
  "Properties": {
    "KeyPairName": String,
    "RefreshOptions": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

KeyPairName

String

Yes

Yes

The name of the key pair.

None.

RefreshOptions

String

No

Yes

The refresh policy for data source resources when the stack is updated.

Valid values:

  • Never (default): does not refresh data source resources when the stack is updated.

  • Always: refreshes data source resources when the stack is updated.

Return values

Fn::GetAtt

  • KeyPairName: the name of the key pair.

  • ResourceGroupId: the ID of the resource group.

  • CreateTime: the time when the key pair was created.

  • FingerPrint: the fingerprint of the key pair.

  • Tags: the tags that are added to the key pair.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  KeyPairName:
    Type: String
    Description:
      en: |-
        The name of the key pair. You can use the asterisk (*) symbol as a wildcard in regular expressions to perform a fuzzy search for key pairs. Sample patterns:
        - *SshKey: queries key pairs whose names end with SshKey, including the key pair named SshKey.
        - SshKey*: queries key pairs whose names start with SshKey, including the key pair named SshKey.
        - *SshKey*: queries key pairs whose names include SshKey, including the key pair named SshKey.
        - SshKey: queries the key pair named SshKey.
    Required: true
    AssociationProperty: ALIYUN::ECS::KeyPair::KeyPairName
Resources:
  ExtensionDataSource:
    Type: DATASOURCE::ECS::KeyPair
    Properties:
      KeyPairName:
        Ref: KeyPairName
Outputs:
  KeyPairName:
    Description: The name of the key pair.
    Value:
      Fn::GetAtt:
        - ExtensionDataSource
        - KeyPairName
  ResourceGroupId:
    Description: The ID of the resource group.
    Value:
      Fn::GetAtt:
        - ExtensionDataSource
        - ResourceGroupId
  CreateTime:
    Description: The time when the key pair was created.
    Value:
      Fn::GetAtt:
        - ExtensionDataSource
        - CreateTime
  FingerPrint:
    Description: The fingerprint of the key pair.
    Value:
      Fn::GetAtt:
        - ExtensionDataSource
        - FingerPrint
  Tags:
    Description: The tags of the key pair.
    Value:
      Fn::GetAtt:
        - ExtensionDataSource
        - Tags
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "KeyPairName": {
      "Type": "String",
      "Description": {
        "en": "The name of the key pair. You can use the asterisk (*) symbol as a wildcard in regular expressions to perform a fuzzy search for key pairs. Sample patterns:\n- *SshKey: queries key pairs whose names end with SshKey, including the key pair named SshKey.\n- SshKey*: queries key pairs whose names start with SshKey, including the key pair named SshKey.\n- *SshKey*: queries key pairs whose names include SshKey, including the key pair named SshKey.\n- SshKey: queries the key pair named SshKey."
      },
      "Required": true,
      "AssociationProperty": "ALIYUN::ECS::KeyPair::KeyPairName"
    }
  },
  "Resources": {
    "ExtensionDataSource": {
      "Type": "DATASOURCE::ECS::KeyPair",
      "Properties": {
        "KeyPairName": {
          "Ref": "KeyPairName"
        }
      }
    }
  },
  "Outputs": {
    "KeyPairName": {
      "Description": "The name of the key pair.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "KeyPairName"
        ]
      }
    },
    "ResourceGroupId": {
      "Description": "The ID of the resource group.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "ResourceGroupId"
        ]
      }
    },
    "CreateTime": {
      "Description": "The time when the key pair was created.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "CreateTime"
        ]
      }
    },
    "FingerPrint": {
      "Description": "The fingerprint of the key pair.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "FingerPrint"
        ]
      }
    },
    "Tags": {
      "Description": "The tags of the key pair.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "Tags"
        ]
      }
    }
  }
}