All Products
Search
Document Center

Cloud Config:GetConfigRule

Last Updated:Dec 12, 2024

Queries the details of a rule.

Operation description

This topic provides an example on how to query the details of the cr-7f7d626622af0041**** rule.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
config:GetConfigRuleget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ConfigRuleIdstringYes

The rule ID.

For more information about how to obtain the ID of a rule, see ListConfigRules .

cr-7f7d626622af0041****

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object
ConfigRuleobject

The details of the rule.

AccountIdlong

The ID of the Alibaba Cloud account to which the rule belongs.

120886317861****
Complianceobject

The details of compliance evaluation results.

ComplianceTypestring

The statistics on the compliance evaluation results by compliance type. Valid values:

  • COMPLIANT: The resource was evaluated as compliant.
  • NON_COMPLIANT: The resource was evaluated as incompliant.
  • NOT_APPLICABLE: The rule did not apply to your resource.
  • INSUFFICIENT_DATA: No resource data was available.
NON_COMPLIANT
Countinteger

The number of evaluated resources.

3
ConfigRuleArnstring

The ARN of the managed rule.

acs:config::100931896542****:rule/cr-7f7d626622af0041****
ConfigRuleEvaluationStatusobject

The information about compliance evaluations performed by the rule.

FirstActivatedTimestamplong

The timestamp generated when the rule was first triggered. Unit: millisecond.

1624932221993
FirstEvaluationStartedboolean

Indicates whether resource configurations were evaluated based on the rule. Valid values:

  • true: Resource configurations were evaluated based on the rule.
  • false: Resource configurations were not evaluated based on the rule.
true
LastErrorCodestring

The error code returned for the previous failed compliance evaluation.

TimeOut
LastErrorMessagestring

The error message returned for the previous failed compliance evaluation.

Time out
LastFailedEvaluationTimestamplong

The timestamp generated when the previous failed compliance evaluation of the rule ended. Unit: millisecond.

1614687022000
LastFailedInvocationTimestamplong

The timestamp generated when the previous failed compliance evaluation of the rule started. Unit: millisecond.

1614687022000
LastSuccessfulEvaluationTimestamplong

The timestamp generated when the previous successful compliance evaluation of the rule ended. Unit: millisecond.

1624932227486
LastSuccessfulInvocationTimestamplong

The timestamp generated when the previous successful compliance evaluation of the rule started. Unit: millisecond.

1624932227476
ConfigRuleIdstring

The rule ID.

cr-7f7d626622af0041****
ConfigRuleNamestring

The name of the rule.

ecs-disk-auto-snapshot-policy
ConfigRuleStatestring

The status of the rule. Valid values:

  • ACTIVE: The rule is enabled.
  • DELETING: The rule is being deleted.
  • EVALUATING: The rule is being used to evaluate resource configurations.
  • INACTIVE: The rule is disabled.
ACTIVE
ConfigRuleTriggerTypesstring

The trigger type of the rule. Valid values:

  • ConfigurationItemChangeNotification: The rule was triggered by configuration changes.
  • ScheduledNotification: The rule was periodically triggered.
ConfigurationItemChangeNotification
CreateByobject

The information about the creation of the rule.

CompliancePackIdstring

The compliance package ID.

cp-541e626622af008****
CompliancePackNamestring

The name of the compliance package.

example-name
CreatorIdstring

The ID of the account that was used to create the rule.

100931896542****
CreatorNamestring

The name of the account that was used to create the rule.

Alice
CreateTimestamplong

The timestamp generated when the rule was created. Unit: millisecond.

1604684022000
Descriptionstring

The description of the managed rule.

example-description
ExcludeRegionIdsScopestring

ExcludeRegionIdsScope

cn-shanghai
ExcludeResourceGroupIdsScopestring

ExcludeResourceGroupIdsScope

rg-aekzdibsjjc****
ExcludeResourceIdsScopestring

The ID of the resource excluded from the compliance evaluations performed by the rule.

23642660635687****
ExcludeTagsScopearray<object>

ExcludeTagsScope

complianceExcludeTagsScopeobject
TagKeystring

The tag key.

key-1
TagValuestring

The tag value.

value-1
ExtendContentstring

Optional field, only used in conjunction with the 24-hour cycle execution to set the trigger time.

{"fixedHour":"12"}
InputParametersobject

The input parameters of the rule.

{}
ManagedRuleobject

The details of the managed rule.

CompulsoryInputParameterDetailsobject

The settings of the required input parameters for the managed rule.

{}
Descriptionstring

The description of the managed rule.

example-description
Identifierstring

The identifier of the managed rule.

ram-user-mfa-check
Labelsarray

The rule tags.

Labelsstring

The tag of the managed rule.

["RAM","User"]
ManagedRuleNamestring

The name of the managed rule.

example-name
OptionalInputParameterDetailsobject

The settings of the optional input parameters for the managed rule.

{}
SourceDetailsarray<object>

The details of the source of the managed rule.

SourceDetailsobject
EventSourcestring

The event source.

Note Only aliyun.config is returned, which indicates that only events related to Cloud Config are supported.
aliyun.config
MaximumExecutionFrequencystring

The interval at which the rule is triggered. Valid values:

  • One_Hour
  • Three_Hours
  • Six_Hours
  • Twelve_Hours
  • TwentyFour_Hours
Note This parameter is returned if the rule is periodically triggered.
One_Hour
MessageTypestring

The trigger type of the rule. Valid values:

  • ConfigurationItemChangeNotification: The rule is triggered by configuration changes.
  • ScheduledNotification: The rule is periodically triggered.
ConfigurationItemChangeNotification
MaximumExecutionFrequencystring

The interval at which the rule is triggered. Valid values:

  • One_Hour
  • Three_Hours
  • Six_Hours
  • Twelve_Hours
  • TwentyFour_Hours
Note This parameter is returned if the rule is periodically triggered.
One_Hour
ModifiedTimestamplong

The timestamp generated when the rule was last updated. Unit: millisecond.

1614687022000
RegionIdsScopestring

The ID of the region to which the rule applies.

global
ResourceGroupIdsScopestring

The ID of the resource group to which the rule applies.

rg-aekzdibsjjc****
ResourceIdsScopestring

ResourceIdsScope

eip-8vbf3x310fn56ijfd****
ResourceTypesScopestring

The type of the resource to be evaluated by the rule.

ACS::RAM::User
RiskLevelinteger

The risk level of the resources that do not comply with the rule. Valid values:

  • 1: high.
  • 2: medium.
  • 3: low.
1
Scopeobject

The effective scope of the rule.

ComplianceResourceTypesarray

The types of the resources to be evaluated against the rule. You can also view the resource types by using the ResourceTypesScope parameter.

ComplianceResourceTypesstring

The type of the resource to be evaluated against the rule.

ACS::RAM::User
Sourceobject

The information about how the rule was created.

Identifierstring

The identifier of the rule.

  • If the rule is a managed rule, the value of this parameter is the identifier of the managed rule.
  • If the rule is a custom rule, the value of this parameter is the Alibaba Cloud Resource Name (ARN) of a function.
acs:fc:cn-hangzhou:100931896542****:services/ConfigService.LATEST/functions/specific-config
Ownerstring

The type of the rule. Valid values:

  • CUSTOM_FC: a custom rule.
  • ALIYUN: a managed rule.
ALIYUN
SourceDetailsarray<object>

The details of the source of the rule.

SourceDetailsobject
EventSourcestring

The event source.

Note Only aliyun.config is returned, which indicates that only events related to Cloud Config are supported.
aliyun.config
MaximumExecutionFrequencystring

The interval at which the rule is triggered. Valid values:

  • One_Hour
  • Three_Hours
  • Six_Hours
  • Twelve_Hours
  • TwentyFour_Hours
Note This parameter is returned if the rule is periodically triggered.
One_Hour
MessageTypestring

The trigger type of the rule. Valid values:

  • ConfigurationItemChangeNotification: The rule is triggered by configuration changes.
  • ScheduledNotification: The rule is periodically triggered.
ConfigurationItemChangeNotification
TagKeyLogicScopestring

The ID of the member account to which the rule does not apply, which means that the resources within the member account are not evaluated based on the rule.

Note This parameter applies only to a managed rule.
120886317861****
TagKeyScopestring

The tag key used to filter resources. The rule applies only to the resources with the specified tag key.

Note The TagKeyScope and TagValueScope parameters are returned at the same time.
RAM
TagValueScopestring

The tag value used to filter resources. The rule applies only to the resources with the specified tag value.

Note The TagKeyScope and TagValueScope parameters are returned at the same time.
MFA
TagsScopearray<object>

TagsScope

tagsScopeobject
TagKeystring

TagKey

key-1
TagValuestring

TagValue

value-1
RequestIdstring

The request ID.

811234F4-C3AB-4D15-B90B-F55016D1B5AA

Examples

Sample success responses

JSONformat

{
  "ConfigRule": {
    "AccountId": 0,
    "Compliance": {
      "ComplianceType": "NON_COMPLIANT",
      "Count": 3
    },
    "ConfigRuleArn": "acs:config::100931896542****:rule/cr-7f7d626622af0041****",
    "ConfigRuleEvaluationStatus": {
      "FirstActivatedTimestamp": 1624932221993,
      "FirstEvaluationStarted": true,
      "LastErrorCode": "TimeOut",
      "LastErrorMessage": "Time out",
      "LastFailedEvaluationTimestamp": 1614687022000,
      "LastFailedInvocationTimestamp": 1614687022000,
      "LastSuccessfulEvaluationTimestamp": 1624932227486,
      "LastSuccessfulInvocationTimestamp": 1624932227476
    },
    "ConfigRuleId": "cr-7f7d626622af0041****",
    "ConfigRuleName": "ecs-disk-auto-snapshot-policy",
    "ConfigRuleState": "ACTIVE",
    "ConfigRuleTriggerTypes": "ConfigurationItemChangeNotification",
    "CreateBy": {
      "CompliancePackId": "cp-541e626622af008****",
      "CompliancePackName": "example-name",
      "CreatorId": "100931896542****",
      "CreatorName": "Alice"
    },
    "CreateTimestamp": 1604684022000,
    "Description": "example-description",
    "ExcludeRegionIdsScope": "cn-shanghai",
    "ExcludeResourceGroupIdsScope": "rg-aekzdibsjjc****",
    "ExcludeResourceIdsScope": "23642660635687****",
    "ExcludeTagsScope": [
      {
        "TagKey": "key-1",
        "TagValue": "value-1"
      }
    ],
    "ExtendContent": "{\"fixedHour\":\"12\"}",
    "InputParameters": {},
    "ManagedRule": {
      "CompulsoryInputParameterDetails": {},
      "Description": "example-description",
      "Identifier": "ram-user-mfa-check",
      "Labels": [
        "[\"RAM\",\"User\"]"
      ],
      "ManagedRuleName": "example-name",
      "OptionalInputParameterDetails": {},
      "SourceDetails": [
        {
          "EventSource": "aliyun.config",
          "MaximumExecutionFrequency": "One_Hour",
          "MessageType": "ConfigurationItemChangeNotification"
        }
      ]
    },
    "MaximumExecutionFrequency": "One_Hour",
    "ModifiedTimestamp": 1614687022000,
    "RegionIdsScope": "global",
    "ResourceGroupIdsScope": "rg-aekzdibsjjc****",
    "ResourceIdsScope": "eip-8vbf3x310fn56ijfd****\n",
    "ResourceTypesScope": "ACS::RAM::User",
    "RiskLevel": 1,
    "Scope": {
      "ComplianceResourceTypes": [
        "ACS::RAM::User"
      ]
    },
    "Source": {
      "Identifier": "acs:fc:cn-hangzhou:100931896542****:services/ConfigService.LATEST/functions/specific-config",
      "Owner": "ALIYUN",
      "SourceDetails": [
        {
          "EventSource": "aliyun.config",
          "MaximumExecutionFrequency": "One_Hour",
          "MessageType": "ConfigurationItemChangeNotification"
        }
      ]
    },
    "TagKeyLogicScope": "120886317861****",
    "TagKeyScope": "RAM",
    "TagValueScope": "MFA",
    "TagsScope": [
      {
        "TagKey": "key-1",
        "TagValue": "value-1"
      }
    ]
  },
  "RequestId": "811234F4-C3AB-4D15-B90B-F55016D1B5AA"
}

Error codes

HTTP status codeError codeError messageDescription
400ConfigRuleNotExistsThe ConfigRule does not exist.The rule does not exist.
400NoPermissionYou are not authorized to perform this operation.You are not authorized to perform this operation.
404AccountNotExistedYour account does not exist.-
503ServiceUnavailableThe request has failed due to a temporary failure of the server.The request has failed due to a temporary failure of the server.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-04-18The Error code has changed. The response structure of the API has changedView Change Details