AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
ListResourceComplianceSummaries
与 a 一起使用 CLI
以下代码示例演示如何使用 ListResourceComplianceSummaries
。
- CLI
-
- AWS CLI
-
列出资源级合规性摘要计数
此示例列出资源级合规性摘要计数。
命令:
aws ssm list-resource-compliance-summaries
输出:
{ "ResourceComplianceSummaryItems": [ { "ComplianceType": "Association", "ResourceType": "ManagedInstance", "ResourceId": "i-1234567890abcdef0", "Status": "COMPLIANT", "OverallSeverity": "UNSPECIFIED", "ExecutionSummary": { "ExecutionTime": 1550509273.0 }, "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", "ResourceType": "ManagedInstance", "ResourceId": "i-9876543210abcdef0", "Status": "COMPLIANT", "OverallSeverity": "UNSPECIFIED", "ExecutionSummary": { "ExecutionTime": 1550248550.0, "ExecutionId": "7abb6378-a4a5-4f10-8312-0123456789ab", "ExecutionType": "Command" }, "CompliantSummary": { "CompliantCount": 397, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 397 } }, "NonCompliantSummary": { "NonCompliantCount": 0, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } } ], "NextToken": "--token string truncated--" }
列出特定合性规类型的资源级合规性摘要
此示例列出补丁合规性类型的资源级合规性摘要。
命令:
aws ssm list-resource-compliance-summaries --filters
"Key=ComplianceType,Values=Patch,Type=EQUAL"
-
有关API详细信息,请参阅 “ListResourceComplianceSummaries AWS CLI
命令参考”。
-
- PowerShell
-
- 用于 PowerShell
-
示例 1:此示例获取资源级摘要计数。摘要包含有关合规和不合规状态的信息以及与“Windows10”匹配产品的详细合规性项目严重性计数。由于如果未指定参数,则 MaxResult 默认值为 100,且此值无效,因此会添加 MaxResult 参数,并将该值设置为 50。
$FilterValues = @{ "Key"="Product" "Type"="EQUAL" "Values"="Windows10" } Get-SSMResourceComplianceSummaryList -Filter $FilterValues -MaxResult 50
-
有关API详细信息,请参阅 AWS Tools for PowerShell Cmdlet 参考ListResourceComplianceSummaries中的。
-
ListInventoryEntries
ListTagsForResource