文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
ListComplianceSummaries
搭配 CLI 使用
下列程式碼範例示範如何使用 ListComplianceSummaries
。
- CLI
-
- AWS CLI
-
列出所有合規類型的合規摘要
此範例會列出您帳戶中所有合規類型的合規摘要。
命令:
aws ssm list-compliance-summaries
輸出:
{ "ComplianceSummaryItems": [ { "ComplianceType": "Association", "CompliantSummary": { "CompliantCount": 2, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 2 } }, "NonCompliantSummary": { "NonCompliantCount": 0, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } }, { "ComplianceType": "Patch", "CompliantSummary": { "CompliantCount": 1, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 1 } }, "NonCompliantSummary": { "NonCompliantCount": 1, "SeveritySummary": { "CriticalCount": 1, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } }, ... ], "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==" }
列出特定合規類型的合規摘要
此範例列出修補程式合規類型的合規摘要。
命令:
aws ssm list-compliance-summaries --filters
"Key=ComplianceType,Values=Patch,Type=EQUAL"
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 ListComplianceSummaries
。
-
- PowerShell
-
- for PowerShell 工具
-
範例 1:此範例會傳回所有合規類型的合規和不合規資源摘要計數。
Get-SSMComplianceSummaryList
輸出:
ComplianceType CompliantSummary NonCompliantSummary -------------- ---------------- ------------------- FleetTotal Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary Association Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary Custom:InSpec Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary Patch Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary
-
如需 API 詳細資訊,請參閱 AWS Tools for PowerShell Cmdlet 參考中的 ListComplianceSummaries。
-
ListComplianceItems
ListDocumentVersions