All Products
Search
Document Center

Resource Orchestration Service:DATASOURCE::RDS::Databases

最終更新日:Dec 06, 2024

DATASOURCE::RDS::Databases is used to query the information about databases on an ApsaraDB RDS instance.

Syntax

{
  "Type": "DATASOURCE::RDS::Databases",
  "Properties": {
    "DBInstanceId": String,
    "DBName": String,
    "DBStatus": String,
    "RefreshOptions": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

DBInstanceId

String

Yes

Yes

The instance ID.

None.

DBName

String

No

Yes

The database name.

None.

DBStatus

String

No

Yes

The status of the database.

Valid values:

  • Creating: The database is being created.

  • Running: The database is being used.

  • Deleting: The database is being deleted.

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)

  • Databases: details of the databases.

  • DBNames: the names of the databases.

Property

Type

Description

Constraint

DBNames

List

The names of the databases.

None.

Databases

List

Details of the databases.

None.

DBName

String

The database name.

None.

DBInstanceId

String

The ID of the instance to which the database belongs.

None.

Engine

String

The database engine of the instance.

None.

DBStatus

String

The status of the database.

Valid values:

  • Creating: The database is being created.

  • Running: The database is being used.

  • Deleting: The database is being deleted.

CharacterSetName

String

The character set.

None.

DBDescription

String

The description of the database.

None.

Accounts

Map

The accounts that have specific permissions on the database.

Example:

{
    "Account": "Demo",
    "AccountPrivilege":"ReadOnly",
    "AccountPrivilegeDetail":"SELECT"
}

Examples

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "DBInstanceId": {
      "Type": "String",
      "Description": "The ID of the RDS instance."
    }
  },
  "Resources": {
    "ExtensionDataSource": {
      "Type": "DATASOURCE::RDS::Databases",
      "Properties": {
        "DBInstanceId": {
          "Ref": "DBInstanceId"
        }
      }
    }
  },
  "Outputs": {
    "Databases": {
      "Description": "The list of The RDS databases.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "Databases"
        ]
      }
    },
    "DBNames": {
      "Description": "The list of The RDS database names.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "DBNames"
        ]
      }
    }
  }
}
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DBInstanceId:
    Type: String
    Description: The ID of the RDS instance.
Resources:
  ExtensionDataSource:
    Type: DATASOURCE::RDS::Databases
    Properties:
      DBInstanceId:
        Ref: DBInstanceId
Outputs:
  Databases:
    Description: The list of The RDS databases.
    Value:
      Fn::GetAtt:
        - ExtensionDataSource
        - Databases
  DBNames:
    Description: The list of The RDS database names.
    Value:
      Fn::GetAtt:
        - ExtensionDataSource
        - DBNames