mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(ssm): add DescribePatchBaselines and GetDefaultPatchBaseline (#1404)
Return AWS-owned predefined patch baselines (one default per operating system) so Terraform's aws_ssm_patch_baseline data source resolves. Supports DescribePatchBaselines filters OWNER/OPERATING_SYSTEM/NAME_PREFIX and GetDefaultPatchBaseline. Read-only reference data; no customer-owned baselines. Refs #956
This commit is contained in:
1 parent
f3f481cb4d
commit
be9e61d788
5 files changed
+221
No files matched your search
@@ -233,6 +233,89 @@ class SsmIntegrationTest {
|
||||
.body("DeletedParameters.size()", equalTo(2));
|
||||
}
|
||||
|
||||
// ── Issue #956: DescribePatchBaselines / GetDefaultPatchBaseline (AWS-owned predefined) ──
|
||||
|
||||
@Test
|
||||
void describePatchBaselines_filteredByOwnerAndOperatingSystem() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonSSM.DescribePatchBaselines")
|
||||
.contentType(SSM_CONTENT_TYPE)
|
||||
.body("""
|
||||
{
|
||||
"Filters": [
|
||||
{"Key": "OWNER", "Values": ["AWS"]},
|
||||
{"Key": "OPERATING_SYSTEM", "Values": ["AMAZON_LINUX_2"]}
|
||||
]
|
||||
}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("BaselineIdentities.size()", equalTo(1))
|
||||
.body("BaselineIdentities[0].BaselineName", equalTo("AWS-AmazonLinux2DefaultPatchBaseline"))
|
||||
.body("BaselineIdentities[0].OperatingSystem", equalTo("AMAZON_LINUX_2"))
|
||||
.body("BaselineIdentities[0].DefaultBaseline", equalTo(true))
|
||||
.body("BaselineIdentities[0].BaselineId", startsWith("pb-"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void describePatchBaselines_byNamePrefixReturnsPredefined() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonSSM.DescribePatchBaselines")
|
||||
.contentType(SSM_CONTENT_TYPE)
|
||||
.body("""
|
||||
{
|
||||
"Filters": [
|
||||
{"Key": "NAME_PREFIX", "Values": ["AWS-"]}
|
||||
]
|
||||
}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("BaselineIdentities.size()", greaterThan(1))
|
||||
.body("BaselineIdentities.BaselineName", everyItem(startsWith("AWS-")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void describePatchBaselines_ownerSelfReturnsEmpty() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonSSM.DescribePatchBaselines")
|
||||
.contentType(SSM_CONTENT_TYPE)
|
||||
.body("""
|
||||
{
|
||||
"Filters": [
|
||||
{"Key": "OWNER", "Values": ["Self"]}
|
||||
]
|
||||
}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("BaselineIdentities.size()", equalTo(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getDefaultPatchBaseline_windows() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonSSM.GetDefaultPatchBaseline")
|
||||
.contentType(SSM_CONTENT_TYPE)
|
||||
.body("""
|
||||
{
|
||||
"OperatingSystem": "WINDOWS"
|
||||
}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("OperatingSystem", equalTo("WINDOWS"))
|
||||
.body("BaselineId", startsWith("pb-"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void unsupportedOperation() {
|
||||
given()
|
||||
|
||||
Reference in new issue
Block a user