mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(kms): add EnableKey support (#1381)
This commit is contained in:
1 parent
660a8bceb3
commit
ca5fb043a7
4 files changed
+105
No files matched your search
@@ -381,6 +381,92 @@ class KmsIntegrationTest {
|
||||
.body("KeyMetadata.KeyState", equalTo("Disabled"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableKeyRestoresKeyState() {
|
||||
String keyId = given()
|
||||
.header("X-Amz-Target", "TrentService.CreateKey")
|
||||
.contentType(KMS_CONTENT_TYPE)
|
||||
.body("{\"Description\":\"enable-key\"}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract()
|
||||
.path("KeyMetadata.KeyId");
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "TrentService.DisableKey")
|
||||
.contentType(KMS_CONTENT_TYPE)
|
||||
.body("""
|
||||
{"KeyId":"%s"}
|
||||
""".formatted(keyId))
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "TrentService.EnableKey")
|
||||
.contentType(KMS_CONTENT_TYPE)
|
||||
.body("""
|
||||
{"KeyId":"%s"}
|
||||
""".formatted(keyId))
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "TrentService.DescribeKey")
|
||||
.contentType(KMS_CONTENT_TYPE)
|
||||
.body("""
|
||||
{"KeyId":"%s"}
|
||||
""".formatted(keyId))
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("KeyMetadata.Enabled", equalTo(true))
|
||||
.body("KeyMetadata.KeyState", equalTo("Enabled"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableKeyOnPendingDeletionKeyFails() {
|
||||
String keyId = given()
|
||||
.header("X-Amz-Target", "TrentService.CreateKey")
|
||||
.contentType(KMS_CONTENT_TYPE)
|
||||
.body("{\"Description\":\"enable-pending-deletion\"}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract()
|
||||
.path("KeyMetadata.KeyId");
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "TrentService.ScheduleKeyDeletion")
|
||||
.contentType(KMS_CONTENT_TYPE)
|
||||
.body("""
|
||||
{"KeyId":"%s","PendingWindowInDays":7}
|
||||
""".formatted(keyId))
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "TrentService.EnableKey")
|
||||
.contentType(KMS_CONTENT_TYPE)
|
||||
.body("""
|
||||
{"KeyId":"%s"}
|
||||
""".formatted(keyId))
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("KMSInvalidStateException"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateKeyDescriptionRequiresDescription() {
|
||||
String keyId = given()
|
||||
|
||||
Reference in new issue
Block a user