為當前帳號建立合規包。
介面說明
合規包是一組規則的集合。建立合規包時,您可以選擇合規包模板中的預設規則,也可以選擇規則模板和已有規則列表中的規則。 建立合規包後,這些規則預設會執行一次評估,後續將根據規則的觸發機制自動觸發評估,也可以手動執行評估。
合規包模板是配置審計根據合規情境定製的一組規則的集合。
本文將提供一個樣本,通過合規包模板ClassifiedProtectionPreCheck(等保三級預檢合規包)建立一個合規包。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
config:CreateCompliancePack |
create |
*CompliancePack
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| CompliancePackTemplateId |
string |
否 |
合規包模板 ID。 關於如何擷取合規包模板 ID,請參見 ListCompliancePackTemplates 。 |
ct-5f26ff4e06a300c4**** |
| CompliancePackName |
string |
是 |
合規包名稱。 |
等保三級預檢合規包 |
| Description |
string |
否 |
合規包描述。 |
等保三級預檢合規包 |
| RiskLevel |
integer |
否 |
合規包風險等級。取值:
|
2 |
| ConfigRules |
array<object> |
否 |
合規包中的規則列表。 說明
本參數和 |
|
|
array<object> |
否 |
合規包中的規則列表。 |
||
| ManagedRuleIdentifier |
string |
否 |
規則模板標識。配置審計根據規則模板標識自動建立規則,並將該規則加入到當前合規包中。 說明
|
eip-bandwidth-limit |
| ConfigRuleName |
string |
否 |
規則名稱。 |
彈性IP執行個體頻寬滿足最低要求 |
| ConfigRuleParameters |
array<object> |
否 |
規則參數資訊。 |
|
|
object |
否 |
規則參數資訊。 |
||
| ParameterName |
string |
否 |
規則參數名稱。 參數 |
bandwidth |
| ParameterValue |
string |
否 |
規則參數值。 參數 |
10 |
| ConfigRuleId |
string |
否 |
規則 ID。配置審計將已有規則加入到當前合規包中。
|
cr-e918626622af000f**** |
| Description |
string |
否 |
規則描述。 |
彈性公網已綁定到ECS或者NAT執行個體,非閑置狀態,視為“合規”。 |
| RiskLevel |
integer |
否 |
規則風險等級。取值:
|
1 |
| TemplateContent |
string |
否 |
用於產生合規包的模板資訊。模板內容可以從已有合規包詳情 API 中查看,或者參考編寫配置化合規包模板進行編寫。 說明
本參數和 ConfigRules 必須設定其中一個。 |
{ "configRuleTemplates": [ { "configRuleName": "自訂條件規則樣本", "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": "OSS儲存空間Referer在指定的防盜鏈白名單中", "scope": { "complianceResourceTypes": [ "ACS::OSS::Bucket" ] }, "description": "OSS儲存空間開啟防盜鏈並且Referer在指定白名單中,視為“合規”。", "source": { "owner": "ALIYUN", "identifier": "oss-bucket-referer-limit", "sourceDetails": [ { "messageType": "ConfigurationItemChangeNotification" } ] }, "inputParameters": { "allowEmptyReferer": "true", "allowReferers": "http://www.aliyun.com" } } ] } |
| ClientToken |
string |
否 |
保證請求等冪性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。 |
1594295238-f9361358-5843-4294-8d30-b5183fac**** |
| DefaultEnable |
boolean |
否 |
規則是否支援快速啟用。取值:
|
false |
| RegionIdsScope |
string |
否 |
合規包僅對指定地區 ID 中的資源生效。多個地區 ID 之間用半形逗號(,)分隔。 |
cn-hangzhou |
| ExcludeRegionIdsScope |
string |
否 |
排除的地區範圍,多個地區 ID 之間用半形逗號(,)分隔。 |
cn-hangzhou |
| ExcludeResourceIdsScope |
string |
否 |
合規包對指定資源 ID 無效,即不對該資源執行評估。多個資源 ID 之間用半形逗號(,)分隔。 |
eip-8vbf3x310fn56ijfd**** |
| ResourceIdsScope |
string |
否 |
生效的資源範圍,多個地區 ID 之間用半形逗號(,)分隔。 |
eip-8vbf3x310fn56ijfd**** |
| ResourceGroupIdsScope |
string |
否 |
合規包僅對指定資源群組 ID 中的資源生效。多個資源群組 ID 之間用半形逗號(,)分隔。 |
rg-aekzdibsjjc**** |
| ExcludeResourceGroupIdsScope |
string |
否 |
合規包僅對指定資源群組 ID 中的資源不生效。多個資源群組 ID 之間用半形逗號(,)分隔。 |
rg-bnczc6r7rml**** |
| TagKeyScope |
string |
否 |
合規包僅對綁定指定標籤鍵的資源生效。 |
ECS |
| TagValueScope |
string |
否 |
合規包僅對綁定指定標籤索引值對的資源生效。 說明
TagValueScope 需結合 TagKeyScope 一起使用。 |
test |
| TagsScope |
array<object> |
否 |
標籤範圍 |
|
|
object |
否 |
|||
| TagKey |
string |
否 |
資源的標籤。 |
key-1 |
| TagValue |
string |
否 |
標籤值。 |
value-1 |
| ExcludeTagsScope |
array<object> |
否 |
排除的標籤範圍 |
|
|
object |
否 |
排除的標籤範圍 |
||
| TagKey |
string |
否 |
標籤鍵。 |
key-2 |
| TagValue |
string |
否 |
標籤值。 |
value-2 |
| Tag |
array<object> |
否 |
資源的標籤。 最多支援綁定 20 個標籤。 |
|
|
object |
否 |
資源的標籤。 最多支援綁定 20 個標籤。 |
||
| Key |
string |
否 |
資源的標籤鍵。 最多支援綁定 20 個標籤鍵。 |
key-1 |
| Value |
string |
否 |
資源的標籤值。 最多支援綁定 20 個標籤值。 |
value-1 |
關於公用請求參數的詳情,請參見公用參數。
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
無 |
||
| CompliancePackId |
string |
合規包 ID。 |
cp-a8a8626622af0082**** |
| RequestId |
string |
請求 ID。 |
6EC7AED1-172F-42AE-9C12-295BC2ADB751 |
樣本
正常返回樣本
JSON格式
{
"CompliancePackId": "cp-a8a8626622af0082****",
"RequestId": "6EC7AED1-172F-42AE-9C12-295BC2ADB751"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | CompliancePackExceedMaxCount | The maximum number of compliance pack is exceeded. | |
| 400 | Invalid.ConfigRules.Empty | You must specify ConfigRules. | |
| 400 | Invalid.ConfigRules.Value | The specified ConfigRules is invalid. | 合規包規則中參數輸入錯誤。 |
| 400 | ConfigRuleExceedMaxRuleCount | The maximum number of config rules is exceeded. | |
| 400 | Invalid.CompliancePackName.Empty | You must specify CompliancePackName. | 合規包名稱不可為空。 |
| 400 | Invalid.CompliancePackName.Value | The specified CompliancePackName is invalid. | 合規包名稱格式不符合要求。 |
| 400 | Invalid.CompliancePackTemplateId.Value | The specified CompliancePackTemplateId does not exist. | 合規包模板ID不存在。 |
| 400 | CompliancePackExists | The compliance pack already exists. | 合規包名稱重複。 |
| 404 | AccountNotExisted | Your account does not exist. | |
| 503 | ServiceUnavailable | The request has failed due to a temporary failure of the server. | 服務不可用。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。