All Products
Search
Document Center

Cloud Config:GetCompliancePack

Last Updated:Jan 24, 2025

Queries the details of a compliance package.

Operation description

This topic provides an example on how to query the details of a compliance package whose ID is cp-fdc8626622af00f9****. The returned result shows that the name of the compliance package is ClassifiedProtectionPreCheck, the compliance package is in the ACTIVE state, and the risk level of the rules in the compliance package is 1, which indicates high risk level.

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:
    • For mandatory resource types, indicate with a prefix of * .
    • 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:GetCompliancePackget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
CompliancePackIdstringYes

The ID of the compliance package.

For more information about how to obtain the ID of a compliance package, see ListCompliancePacks .

cp-a8a8626622af0082****
Tagarray<object>No

The tags of the resource.

You can add up to 20 tags to a resource.

objectNo

The tags of the resource.

You can add up to 20 tags to a resource.

KeystringNo

The tag key.

The tag key cannot be an empty string. The tag key can be up to 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

You can specify at most 20 tag keys.

key-1
ValuestringNo

The tag value. The tag value can be up to 256 characters in length and cannot contain http:// or https://.

value-1

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

6EC7AED1-172F-42AE-9C12-295BC2ADB751
CompliancePackobject

The details of the compliance package.

Statusstring

The status of the compliance package. Valid values:

  • ACTIVE: The compliance package is normal.
  • CREATING: The compliance package is being created.
ACTIVE
CompliancePackIdstring

The ID of the compliance package.

cp-a8a8626622af0082****
RiskLevelinteger

The risk level of the resources that are not compliant with the rules in the compliance package. Valid values:

  • 1: high
  • 2: medium
  • 3: low
1
Descriptionstring

The description of the compliance package.

example-name
ConfigRulesarray<object>

The rules in the compliance package.

ConfigRulesobject

N/A.

ManagedRuleIdentifierstring

The identifier of the managed rule.

eip-bandwidth-limit
ConfigRuleNamestring

The rule name.

eip-bandwidth-limit
ConfigRuleIdstring

The rule ID.

cr-a260626622af0005****
ConfigRuleParametersarray<object>

The input parameters of the rule.

ConfigRuleParametersobject

N/A.

Requiredboolean

Indicates whether the input parameters are required. Valid values:

  • true
  • false
true
ParameterNamestring

The name of the input parameter.

bandwidth
ParameterValuestring

The value of the input parameter.

10
Descriptionstring

The rule description.

example-description
RiskLevelinteger

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

  • 1: high
  • 2: medium
  • 3: low
1
ResourceTypesScopestring

The type of the resource evaluated based on the rule. Separate multiple resource types with commas (,).

ACS::EIP::EipAddress
TemplateContentstring

The information about the current compliance package template. The rules in the template do not contain custom function rules. You can quickly create the same compliance package for other accounts or account groups based on the template information.

{ "configRuleTemplates": [ { "configRuleName": "rule-example", "scope": { "complianceResourceTypes": [ "ACS::ECS::Instance" ] }, "description": "", "source": { "owner": "CUSTOM_CONFIGURATION", "identifier": "acs-config-configuration", "sourceDetails": [ { "messageType": "ScheduledNotification", "maximumExecutionFrequency": "Twelve_Hours" }, { "messageType": "ConfigurationItemChangeNotification" } ], "conditions": "{\"ComplianceConditions\":\"{\\\"operator\\\":\\\"and\\\",\\\"children\\\":[{\\\"operator\\\":\\\"GreaterOrEquals\\\",\\\"featurePath\\\":\\\"$.Cpu\\\",\\\"featureSource\\\":\\\"CONFIGURATION\\\",\\\"desired\\\":\\\"2\\\"}]}\"}" }, "inputParameters": {} }, { "configRuleName": "name", "scope": { "complianceResourceTypes": [ "ACS::OSS::Bucket" ] }, "description": "description-1", "source": { "owner": "ALIYUN", "identifier": "oss-bucket-referer-limit", "sourceDetails": [ { "messageType": "ConfigurationItemChangeNotification" } ] }, "inputParameters": { "allowEmptyReferer": "true", "allowReferers": "http://www.aliyun.com" } } ] }
CompliancePackNamestring

The name of the compliance package.

example-pack-name
AccountIdlong

The ID of the Alibaba Cloud account to which the compliance package belongs.

100931896542****
CompliancePackTemplateIdstring

The ID of the compliance package template.

ct-5f26ff4e06a300c4****
CreateTimestamplong

The timestamp when the compliance package was created. Unit: milliseconds.

1624245766000
Scopeobject

The resource group for which the compliance package took effect.

ExcludeRegionIdsScopestring

The IDs of regions that are excluded. Separate multiple region IDs with commas (,).

cn-hangzhou
ResourceIdsScopestring

The IDs of the resources to which the rule applies. Separate multiple resource IDs with commas (,).

eip-8vbf3x310fn56ijfd****
ExcludeResourceGroupIdsScopestring

The IDs of the resource groups whose resources you do not want to evaluate by using the compliance package. Separate multiple resource group IDs with commas (,).

rg-aekzc7r7rhx****
TagKeyScopestring

The tag key of the resource that you want to evaluate by using the compliance package.

ECS
TagsScopearray<object>

The tag scope.

tagsScopeobject

The tag scope.

TagKeystring

The key of the tag.

key-1
TagValuestring

The value of the tag.

value-1
ExcludeTagsScopearray<object>

The scope of the tag that is excluded.

excludeTagsScopeobject

The scope of the tag that is excluded.

TagKeystring

The key of the tag.

key-2
TagValuestring

The value of the tag.

value-2
TagValueScopestring

The tag value of the resource that you want to evaluate by using the compliance package.

test
RegionIdsScopestring

The ID of the region whose resources you want to evaluate by using the compliance package.

cn-hangzhou
ExcludeResourceIdsScopestring

The ID of the resource that you do not want to evaluate by using the compliance package.

eip-8vbf3x310fn56ijfd****
ResourceGroupIdsScopestring

The ID of the resource group whose resources you want to evaluate by using the compliance package.

rg-aekzc7r7rhx****
Tagsarray<object>

The list of tags.

tagsobject

The tags.

TagKeystring

The tag keys of the resource.

key-1
TagValuestring

The tag values of the resource.

value-1

Examples

Sample success responses

JSONformat

{
  "RequestId": "6EC7AED1-172F-42AE-9C12-295BC2ADB751",
  "CompliancePack": {
    "Status": "ACTIVE",
    "CompliancePackId": "cp-a8a8626622af0082****",
    "RiskLevel": 1,
    "Description": "example-name",
    "ConfigRules": [
      {
        "ManagedRuleIdentifier": "eip-bandwidth-limit",
        "ConfigRuleName": "eip-bandwidth-limit\n",
        "ConfigRuleId": "cr-a260626622af0005****",
        "ConfigRuleParameters": [
          {
            "Required": true,
            "ParameterName": "bandwidth",
            "ParameterValue": "10"
          }
        ],
        "Description": "example-description",
        "RiskLevel": 1,
        "ResourceTypesScope": "ACS::EIP::EipAddress"
      }
    ],
    "TemplateContent": "{\n    \"configRuleTemplates\": [\n        {\n            \"configRuleName\": \"rule-example\",\n            \"scope\": {\n                \"complianceResourceTypes\": [\n                    \"ACS::ECS::Instance\"\n                ]\n            },\n            \"description\": \"\",\n            \"source\": {\n                \"owner\": \"CUSTOM_CONFIGURATION\",\n                \"identifier\": \"acs-config-configuration\",\n                \"sourceDetails\": [\n                    {\n                        \"messageType\": \"ScheduledNotification\",\n                        \"maximumExecutionFrequency\": \"Twelve_Hours\"\n                    },\n                    {\n                        \"messageType\": \"ConfigurationItemChangeNotification\"\n                    }\n                ],\n                \"conditions\": \"{\\\"ComplianceConditions\\\":\\\"{\\\\\\\"operator\\\\\\\":\\\\\\\"and\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"operator\\\\\\\":\\\\\\\"GreaterOrEquals\\\\\\\",\\\\\\\"featurePath\\\\\\\":\\\\\\\"$.Cpu\\\\\\\",\\\\\\\"featureSource\\\\\\\":\\\\\\\"CONFIGURATION\\\\\\\",\\\\\\\"desired\\\\\\\":\\\\\\\"2\\\\\\\"}]}\\\"}\"\n            },\n            \"inputParameters\": {}\n        },\n        {\n            \"configRuleName\": \"name\",\n            \"scope\": {\n                \"complianceResourceTypes\": [\n                    \"ACS::OSS::Bucket\"\n                ]\n            },\n            \"description\": \"description-1\",\n            \"source\": {\n                \"owner\": \"ALIYUN\",\n                \"identifier\": \"oss-bucket-referer-limit\",\n                \"sourceDetails\": [\n                    {\n                        \"messageType\": \"ConfigurationItemChangeNotification\"\n                    }\n                ]\n            },\n            \"inputParameters\": {\n                \"allowEmptyReferer\": \"true\",\n                \"allowReferers\": \"http://www.aliyun.com\"\n            }\n        }\n    ]\n}",
    "CompliancePackName": "example-pack-name",
    "AccountId": 0,
    "CompliancePackTemplateId": "ct-5f26ff4e06a300c4****",
    "CreateTimestamp": 1624245766000,
    "Scope": {
      "ExcludeRegionIdsScope": "cn-hangzhou",
      "ResourceIdsScope": "eip-8vbf3x310fn56ijfd****\n",
      "ExcludeResourceGroupIdsScope": "rg-aekzc7r7rhx****",
      "TagKeyScope": "ECS",
      "TagsScope": [
        {
          "TagKey": "key-1",
          "TagValue": "value-1"
        }
      ],
      "ExcludeTagsScope": [
        {
          "TagKey": "key-2",
          "TagValue": "value-2"
        }
      ],
      "TagValueScope": "test",
      "RegionIdsScope": "cn-hangzhou",
      "ExcludeResourceIdsScope": "eip-8vbf3x310fn56ijfd****",
      "ResourceGroupIdsScope": "rg-aekzc7r7rhx****"
    },
    "Tags": [
      {
        "TagKey": "key-1",
        "TagValue": "value-1"
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400Invalid.CompliancePackId.ValueThe specified CompliancePackId does not exist.The specified compliance pack ID does not exist.
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-12-13The Error code has changed. The response structure of the API has changedView Change Details
2023-06-12API Description Update. The Error code has changed. The response structure of the API has changedView Change Details