All Products
Search
Document Center

Cloud Config:GetCompliancePack

Last Updated:Dec 12, 2024

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:
    • 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: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****

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.

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

Excluded region scope, multiple regions should be separated by commas.

cn-hangzhou
ResourceIdsScopestring

Include ResourceId scope, multiple resourceIds should be separated by commas.

eip-8vbf3x310fn56ijfd****
ExcludeResourceGroupIdsScopestring

Excluded resourceGroup scope, multiple resourceGroup should be separated by commas.

rg-aekzc7r7rhx****
TagKeyScopestring

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

ECS
TagsScopearray<object>

Include tag scope.

tagsScopeobject
TagKeystring

The tag key.

key-1
TagValuestring

The tag value.

value-1
ExcludeTagsScopearray<object>

Exclude tag scope.

excludeTagsScopeobject
TagKeystring

The tag key.

key-2
TagValuestring

The tag value.

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****

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": "",
    "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****"
    }
  }
}

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