DATASOURCE::RAM::Policies

更新时间:
复制 MD 格式

Queries RAM policies, with optional filtering by user, group, role, or policy type.

Syntax

{
  "Type": "DATASOURCE::RAM::Policies",
  "Properties": {
    "GroupName": String,
    "PolicyType": String,
    "RoleName": String,
    "UserName": String,
    "PolicyName": String,
    "RefreshOptions": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

GroupName

String

No

Yes

The name of the RAM user group.

Specify only one of the following properties: UserName, GroupName, or RoleName.

PolicyType

String

No

Yes

The type of the policy.

Valid values:

  • System: a system policy.

  • Custom: a custom policy.

Note

If you do not set this property, policies of all types are returned.

RoleName

String

No

Yes

The name of the RAM role.

Specify only one of the following properties: UserName, GroupName, or RoleName.

UserName

String

No

Yes

The name of the RAM user.

Specify only one of the following properties: UserName, GroupName, or RoleName.

PolicyName

String

No

Yes

The name of the policy.

Supports the asterisk (*) and question mark (?) wildcard characters for fuzzy matching.

RefreshOptions

String

No

Yes

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

Valid values:

  • Never (default): Data source resources are not refreshed when the stack is updated.

  • Always: Data source resources are refreshed when the stack is updated.

Return values (Fn::GetAtt)

  • PolicyNames: the policy names.

  • Policies: the policy details.

Property

Type

Description

Constraint

PolicyNames

List

The policy names.

None.

Policies

List

The policy details.

None.

DefaultVersion

String

The default version of the policy.

None.

Description

String

The description of the policy.

None.

PolicyName

String

The name of the policy.

None.

CreateDate

String

The time when the policy was created, in UTC.

None.

PolicyType

String

The type of the policy.

Valid values:

  • System: a system policy.

  • Custom: a custom policy.

Examples

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "GroupName": {
      "Type": "String",
      "Description": "The specific group to which policies attached.Only one of UserName, GroupName, and RoleName can be specified at most."
    },
    "PolicyType": {
      "Type": "String",
      "Description": "Filter the results by a specific policy type.",
      "AllowedValues": [
        "System",
        "Custom"
      ]
    },
    "RoleName": {
      "Type": "String",
      "Description": "The specific role to which policies attached.Only one of UserName, GroupName, and RoleName can be specified at most."
    },
    "UserName": {
      "Type": "String",
      "Description": "The specific user to which policies attached. Only one of UserName, GroupName, and RoleName can be specified at most."
    },
    "PolicyName": {
      "Type": "String",
      "Description": "Filter the results by a specific policy name. Supports using * and ?  to fuzzy match."
    }
  },
  "Resources": {
    "Policies": {
      "Type": "DATASOURCE::RAM::Policies",
      "Properties": {
        "GroupName": {
          "Ref": "GroupName"
        },
        "PolicyType": {
          "Ref": "PolicyType"
        },
        "RoleName": {
          "Ref": "RoleName"
        },
        "UserName": {
          "Ref": "UserName"
        },
        "PolicyName": {
          "Ref": "PolicyName"
        }
      }
    }
  },
  "Outputs": {
    "PolicyNames": {
      "Description": "The list of policy names.",
      "Value": {
        "Fn::GetAtt": [
          "Policies",
          "PolicyNames"
        ]
      }
    },
    "Policies": {
      "Description": "The list of policies.",
      "Value": {
        "Fn::GetAtt": [
          "Policies",
          "Policies"
        ]
      }
    }
  }
}