mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(ec2): support AMI block public access (#7134)
This commit is contained in:
1 parent
664db0cef3
commit
f489a6f1f3
15 files changed
+402
-214
No files matched your search
+104
@@ -0,0 +1,104 @@
|
||||
package io.github.hectorvent.floci.services.ec2;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.storage.InMemoryStorage;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
class Ec2BlockPublicAccessServiceTest {
|
||||
|
||||
private Ec2BlockPublicAccessService service;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
service = new Ec2BlockPublicAccessService(new InMemoryStorage<>(), new InMemoryStorage<>());
|
||||
}
|
||||
|
||||
@Test
|
||||
void unconfiguredRegionsAreUnblocked() {
|
||||
assertEquals("unblocked",
|
||||
service.getState(Ec2BlockPublicAccessService.Setting.IMAGE, "us-east-1"));
|
||||
assertEquals("unblocked",
|
||||
service.getState(Ec2BlockPublicAccessService.Setting.SNAPSHOT, "us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void imageSettingAcceptsOnlyBlockNewSharing() {
|
||||
assertEquals("block-new-sharing", service.enable(Ec2BlockPublicAccessService.Setting.IMAGE,
|
||||
"us-east-1", "block-new-sharing"));
|
||||
|
||||
AwsException unblocked = assertThrows(AwsException.class,
|
||||
() -> service.enable(Ec2BlockPublicAccessService.Setting.IMAGE, "us-east-1", "unblocked"));
|
||||
assertEquals("InvalidParameterValue", unblocked.getErrorCode());
|
||||
|
||||
AwsException blockAll = assertThrows(AwsException.class,
|
||||
() -> service.enable(Ec2BlockPublicAccessService.Setting.IMAGE,
|
||||
"us-east-1", "block-all-sharing"));
|
||||
assertEquals("InvalidParameterValue", blockAll.getErrorCode());
|
||||
assertEquals("block-new-sharing",
|
||||
service.getState(Ec2BlockPublicAccessService.Setting.IMAGE, "us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void snapshotSettingAcceptsBothBlockingStates() {
|
||||
assertEquals("block-all-sharing", service.enable(Ec2BlockPublicAccessService.Setting.SNAPSHOT,
|
||||
"us-east-1", "block-all-sharing"));
|
||||
assertEquals("block-new-sharing", service.enable(Ec2BlockPublicAccessService.Setting.SNAPSHOT,
|
||||
"us-east-1", "block-new-sharing"));
|
||||
assertEquals("block-new-sharing",
|
||||
service.getState(Ec2BlockPublicAccessService.Setting.SNAPSHOT, "us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void missingStateUsesTheSettingParameterName() {
|
||||
AwsException image = assertThrows(AwsException.class,
|
||||
() -> service.validateEnableState(Ec2BlockPublicAccessService.Setting.IMAGE, null));
|
||||
assertEquals("MissingParameter", image.getErrorCode());
|
||||
assertEquals("The request must contain the parameter ImageBlockPublicAccessState", image.getMessage());
|
||||
|
||||
AwsException snapshot = assertThrows(AwsException.class,
|
||||
() -> service.validateEnableState(Ec2BlockPublicAccessService.Setting.SNAPSHOT, " "));
|
||||
assertEquals("MissingParameter", snapshot.getErrorCode());
|
||||
assertEquals("The request must contain the parameter State", snapshot.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void validationDoesNotChangeStoredState() {
|
||||
service.enable(Ec2BlockPublicAccessService.Setting.SNAPSHOT, "us-east-1", "block-all-sharing");
|
||||
|
||||
assertThrows(AwsException.class,
|
||||
() -> service.validateEnableState(Ec2BlockPublicAccessService.Setting.SNAPSHOT, "unblocked"));
|
||||
assertThrows(AwsException.class,
|
||||
() -> service.validateEnableState(Ec2BlockPublicAccessService.Setting.SNAPSHOT, null));
|
||||
assertEquals("block-all-sharing",
|
||||
service.getState(Ec2BlockPublicAccessService.Setting.SNAPSHOT, "us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void disableReturnsUnblocked() {
|
||||
service.enable(Ec2BlockPublicAccessService.Setting.IMAGE, "us-east-1", "block-new-sharing");
|
||||
|
||||
assertEquals("unblocked",
|
||||
service.disable(Ec2BlockPublicAccessService.Setting.IMAGE, "us-east-1"));
|
||||
assertEquals("unblocked",
|
||||
service.getState(Ec2BlockPublicAccessService.Setting.IMAGE, "us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void statesAreScopedBySettingAndRegion() {
|
||||
service.enable(Ec2BlockPublicAccessService.Setting.IMAGE, "us-east-1", "block-new-sharing");
|
||||
service.enable(Ec2BlockPublicAccessService.Setting.SNAPSHOT, "eu-west-1", "block-all-sharing");
|
||||
|
||||
assertEquals("block-new-sharing",
|
||||
service.getState(Ec2BlockPublicAccessService.Setting.IMAGE, "us-east-1"));
|
||||
assertEquals("unblocked",
|
||||
service.getState(Ec2BlockPublicAccessService.Setting.IMAGE, "eu-west-1"));
|
||||
assertEquals("unblocked",
|
||||
service.getState(Ec2BlockPublicAccessService.Setting.SNAPSHOT, "us-east-1"));
|
||||
assertEquals("block-all-sharing",
|
||||
service.getState(Ec2BlockPublicAccessService.Setting.SNAPSHOT, "eu-west-1"));
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -56,7 +56,7 @@ class Ec2CreateFleetRollbackTest {
|
||||
|
||||
Ec2QueryHandler handler = new Ec2QueryHandler(service, mock(EmulatorConfig.class),
|
||||
mock(FlowLogService.class), mock(Ec2EbsEncryptionService.class),
|
||||
mock(Ec2SnapshotBlockPublicAccessService.class), mock(Ec2IpamService.class),
|
||||
mock(Ec2BlockPublicAccessService.class), mock(Ec2IpamService.class),
|
||||
mock(RegionResolver.class));
|
||||
Response response = handler.handle("CreateFleet", params(), REGION);
|
||||
|
||||
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package io.github.hectorvent.floci.services.ec2;
|
||||
|
||||
import io.github.hectorvent.floci.testing.AwsTestClients;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.ec2.Ec2Client;
|
||||
import software.amazon.awssdk.services.ec2.model.DisableImageBlockPublicAccessRequest;
|
||||
import software.amazon.awssdk.services.ec2.model.Ec2Exception;
|
||||
import software.amazon.awssdk.services.ec2.model.GetImageBlockPublicAccessStateRequest;
|
||||
import software.amazon.awssdk.services.ec2.model.GetImageBlockPublicAccessStateResponse;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
@QuarkusTest
|
||||
class Ec2ImageBlockPublicAccessIntegrationTest {
|
||||
|
||||
private static final String ERROR_AUTH_HEADER =
|
||||
"AWS4-HMAC-SHA256 Credential=814500000002/20261031/us-east-1/ec2/aws4_request";
|
||||
|
||||
@Test
|
||||
void sdkRoundTripUsesAwsResponseShape() {
|
||||
try (Ec2Client client = AwsTestClients.create(Ec2Client.builder(), "814500000001", Region.US_EAST_1)) {
|
||||
GetImageBlockPublicAccessStateResponse initial = getState(client);
|
||||
assertEquals("unblocked", initial.imageBlockPublicAccessState());
|
||||
assertEquals("account", initial.managedByAsString());
|
||||
|
||||
assertEquals("block-new-sharing", client.enableImageBlockPublicAccess(request -> request
|
||||
.imageBlockPublicAccessState("block-new-sharing"))
|
||||
.imageBlockPublicAccessStateAsString());
|
||||
assertEquals("block-new-sharing", getState(client).imageBlockPublicAccessState());
|
||||
|
||||
assertEquals("unblocked", client.disableImageBlockPublicAccess(
|
||||
DisableImageBlockPublicAccessRequest.builder().build())
|
||||
.imageBlockPublicAccessStateAsString());
|
||||
assertEquals("unblocked", getState(client).imageBlockPublicAccessState());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void stateIsScopedByRegion() {
|
||||
try (Ec2Client home = AwsTestClients.create(Ec2Client.builder(), "814500000003", Region.US_EAST_1);
|
||||
Ec2Client away = AwsTestClients.create(Ec2Client.builder(), "814500000003", Region.EU_WEST_1)) {
|
||||
home.enableImageBlockPublicAccess(request -> request
|
||||
.imageBlockPublicAccessState("block-new-sharing"));
|
||||
|
||||
assertEquals("block-new-sharing", getState(home).imageBlockPublicAccessState());
|
||||
assertEquals("unblocked", getState(away).imageBlockPublicAccessState());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableValidatesStateBeforeDryRun() {
|
||||
given()
|
||||
.formParam("Action", "EnableImageBlockPublicAccess")
|
||||
.formParam("ImageBlockPublicAccessState", "unblocked")
|
||||
.formParam("DryRun", "true")
|
||||
.header("Authorization", ERROR_AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("Response.Errors.Error.Code", equalTo("InvalidParameterValue"));
|
||||
|
||||
given()
|
||||
.formParam("Action", "EnableImageBlockPublicAccess")
|
||||
.formParam("DryRun", "true")
|
||||
.header("Authorization", ERROR_AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("Response.Errors.Error.Code", equalTo("MissingParameter"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void dryRunDoesNotChangeState() {
|
||||
try (Ec2Client client = AwsTestClients.create(Ec2Client.builder(), "814500000004", Region.US_EAST_1)) {
|
||||
client.enableImageBlockPublicAccess(request -> request
|
||||
.imageBlockPublicAccessState("block-new-sharing"));
|
||||
|
||||
Ec2Exception disableError = assertThrows(Ec2Exception.class,
|
||||
() -> client.disableImageBlockPublicAccess(request -> request.dryRun(true)));
|
||||
assertEquals("DryRunOperation", disableError.awsErrorDetails().errorCode());
|
||||
assertEquals("block-new-sharing", getState(client).imageBlockPublicAccessState());
|
||||
|
||||
Ec2Exception getError = assertThrows(Ec2Exception.class,
|
||||
() -> client.getImageBlockPublicAccessState(request -> request.dryRun(true)));
|
||||
assertEquals("DryRunOperation", getError.awsErrorDetails().errorCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void onlyGetReturnsManagedBy() {
|
||||
String enableBody = given()
|
||||
.formParam("Action", "EnableImageBlockPublicAccess")
|
||||
.formParam("ImageBlockPublicAccessState", "block-new-sharing")
|
||||
.header("Authorization", ERROR_AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("EnableImageBlockPublicAccessResponse.imageBlockPublicAccessState",
|
||||
equalTo("block-new-sharing"))
|
||||
.extract().asString();
|
||||
assertThat(enableBody, not(containsString("managedBy")));
|
||||
|
||||
given()
|
||||
.formParam("Action", "GetImageBlockPublicAccessState")
|
||||
.header("Authorization", ERROR_AUTH_HEADER)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("GetImageBlockPublicAccessStateResponse.managedBy", equalTo("account"));
|
||||
}
|
||||
|
||||
private static GetImageBlockPublicAccessStateResponse getState(Ec2Client client) {
|
||||
return client.getImageBlockPublicAccessState(GetImageBlockPublicAccessStateRequest.builder().build());
|
||||
}
|
||||
}
|
||||
@@ -664,7 +664,7 @@ class Ec2QueryHandlerTest {
|
||||
private Ec2QueryHandler handler(Ec2Service service, RegionResolver regionResolver) {
|
||||
return new Ec2QueryHandler(
|
||||
service, mock(EmulatorConfig.class), mock(FlowLogService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2SnapshotBlockPublicAccessService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2BlockPublicAccessService.class),
|
||||
mock(Ec2IpamService.class), regionResolver);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ class Ec2RepeatedFilterNamesTest {
|
||||
service = new Ec2Service(config, mock(Ec2ContainerManager.class), mock(Ec2PortForwardManager.class),
|
||||
new AmiImageResolver(imageCatalog), imageCatalog, new Ec2InstanceTypeCatalog(), new MemoryFactory());
|
||||
handler = new Ec2QueryHandler(service, mock(EmulatorConfig.class), mock(FlowLogService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2SnapshotBlockPublicAccessService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2BlockPublicAccessService.class),
|
||||
mock(Ec2IpamService.class), new RegionResolver(REGION, "000000000000"));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ class Ec2RunInstancesPublicIpParamTest {
|
||||
|
||||
private static Ec2QueryHandler handler(Ec2Service service) {
|
||||
return new Ec2QueryHandler(service, mock(EmulatorConfig.class), mock(FlowLogService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2SnapshotBlockPublicAccessService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2BlockPublicAccessService.class),
|
||||
mock(Ec2IpamService.class), mock(RegionResolver.class));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -721,7 +721,7 @@ class Ec2ServicePersistenceTest {
|
||||
.map(KeyPair::getKeyName).toList());
|
||||
|
||||
String xml = (String) new Ec2QueryHandler(restarted, mock(EmulatorConfig.class), mock(FlowLogService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2SnapshotBlockPublicAccessService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2BlockPublicAccessService.class),
|
||||
mock(Ec2IpamService.class), new RegionResolver(REGION, "000000000000"))
|
||||
.handle("DescribeKeyPairs", new MultivaluedHashMap<>(), REGION).getEntity();
|
||||
assertTrue(xml.contains("<keyType>rsa</keyType>"), xml);
|
||||
@@ -828,7 +828,7 @@ class Ec2ServicePersistenceTest {
|
||||
}
|
||||
Response response = new Ec2QueryHandler(service, mock(EmulatorConfig.class),
|
||||
mock(FlowLogService.class), mock(Ec2EbsEncryptionService.class),
|
||||
mock(Ec2SnapshotBlockPublicAccessService.class), mock(Ec2IpamService.class),
|
||||
mock(Ec2BlockPublicAccessService.class), mock(Ec2IpamService.class),
|
||||
new RegionResolver(REGION, "000000000000"))
|
||||
.handle(action, form, REGION);
|
||||
String body = String.valueOf(response.getEntity());
|
||||
|
||||
@@ -340,7 +340,7 @@ class Ec2ServiceTest {
|
||||
List.of(), null, null);
|
||||
Ec2QueryHandler handler = new Ec2QueryHandler(service, mock(EmulatorConfig.class),
|
||||
mock(FlowLogService.class), mock(Ec2EbsEncryptionService.class),
|
||||
mock(Ec2SnapshotBlockPublicAccessService.class), mock(Ec2IpamService.class),
|
||||
mock(Ec2BlockPublicAccessService.class), mock(Ec2IpamService.class),
|
||||
new RegionResolver("us-east-1", "000000000000"));
|
||||
clearInvocations(volumeStore);
|
||||
|
||||
@@ -363,7 +363,7 @@ class Ec2ServiceTest {
|
||||
service.associateAddress("us-east-1", elastic.getAllocationId(), launched.get(1).getInstanceId());
|
||||
Ec2QueryHandler handler = new Ec2QueryHandler(service, mock(EmulatorConfig.class),
|
||||
mock(FlowLogService.class), mock(Ec2EbsEncryptionService.class),
|
||||
mock(Ec2SnapshotBlockPublicAccessService.class), mock(Ec2IpamService.class),
|
||||
mock(Ec2BlockPublicAccessService.class), mock(Ec2IpamService.class),
|
||||
new RegionResolver("us-east-1", "000000000000"));
|
||||
// The first read settles the pending launches, which reads the addresses once per launch.
|
||||
handler.handle("DescribeInstances", new MultivaluedHashMap<>(), "us-east-1");
|
||||
@@ -5613,7 +5613,7 @@ class Ec2ServiceTest {
|
||||
assertTrue(service.describeKeyPairs("us-east-1", List.of(), List.of(),
|
||||
Map.of("key-type", List.of("ed25519"))).isEmpty());
|
||||
String xml = (String) new Ec2QueryHandler(service, mock(EmulatorConfig.class), mock(FlowLogService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2SnapshotBlockPublicAccessService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2BlockPublicAccessService.class),
|
||||
mock(Ec2IpamService.class), new RegionResolver("us-east-1", "000000000000"))
|
||||
.handle("DescribeKeyPairs", new MultivaluedHashMap<>(), "us-east-1").getEntity();
|
||||
assertTrue(xml.contains("<keyPairId>key-unreadable</keyPairId>"), xml);
|
||||
|
||||
-101
@@ -1,101 +0,0 @@
|
||||
package io.github.hectorvent.floci.services.ec2;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.storage.InMemoryStorage;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
class Ec2SnapshotBlockPublicAccessServiceTest {
|
||||
|
||||
private Ec2SnapshotBlockPublicAccessService service;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
service = new Ec2SnapshotBlockPublicAccessService(new InMemoryStorage<>());
|
||||
}
|
||||
|
||||
@Test
|
||||
void unconfiguredRegionIsUnblocked() {
|
||||
assertEquals("unblocked", service.getSnapshotBlockPublicAccessState("us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableStoresBlockAllSharing() {
|
||||
assertEquals("block-all-sharing",
|
||||
service.enableSnapshotBlockPublicAccess("us-east-1", "block-all-sharing"));
|
||||
assertEquals("block-all-sharing", service.getSnapshotBlockPublicAccessState("us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableNarrowsAnExistingBlockToNewSharing() {
|
||||
service.enableSnapshotBlockPublicAccess("us-east-1", "block-all-sharing");
|
||||
|
||||
assertEquals("block-new-sharing",
|
||||
service.enableSnapshotBlockPublicAccess("us-east-1", "block-new-sharing"));
|
||||
assertEquals("block-new-sharing", service.getSnapshotBlockPublicAccessState("us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableRejectsUnblocked() {
|
||||
AwsException thrown = assertThrows(AwsException.class,
|
||||
() -> service.enableSnapshotBlockPublicAccess("us-east-1", "unblocked"));
|
||||
assertEquals("InvalidParameterValue", thrown.getErrorCode());
|
||||
assertEquals("unblocked", service.getSnapshotBlockPublicAccessState("us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableRejectsAnUnknownState() {
|
||||
AwsException thrown = assertThrows(AwsException.class,
|
||||
() -> service.enableSnapshotBlockPublicAccess("us-east-1", "block-everything"));
|
||||
assertEquals("InvalidParameterValue", thrown.getErrorCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableRequiresState() {
|
||||
AwsException missing = assertThrows(AwsException.class,
|
||||
() -> service.enableSnapshotBlockPublicAccess("us-east-1", null));
|
||||
assertEquals("MissingParameter", missing.getErrorCode());
|
||||
|
||||
AwsException blank = assertThrows(AwsException.class,
|
||||
() -> service.enableSnapshotBlockPublicAccess("us-east-1", " "));
|
||||
assertEquals("MissingParameter", blank.getErrorCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void validateEnableStateRejectsWithoutStoringAnything() {
|
||||
service.enableSnapshotBlockPublicAccess("us-east-1", "block-all-sharing");
|
||||
|
||||
assertThrows(AwsException.class, () -> service.validateEnableState("unblocked"));
|
||||
assertThrows(AwsException.class, () -> service.validateEnableState(null));
|
||||
assertEquals("block-all-sharing", service.getSnapshotBlockPublicAccessState("us-east-1"));
|
||||
|
||||
service.validateEnableState("block-new-sharing");
|
||||
assertEquals("block-all-sharing", service.getSnapshotBlockPublicAccessState("us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void disableReturnsUnblocked() {
|
||||
service.enableSnapshotBlockPublicAccess("us-east-1", "block-all-sharing");
|
||||
|
||||
assertEquals("unblocked", service.disableSnapshotBlockPublicAccess("us-east-1"));
|
||||
assertEquals("unblocked", service.getSnapshotBlockPublicAccessState("us-east-1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void stateIsRegionScoped() {
|
||||
service.enableSnapshotBlockPublicAccess("us-east-1", "block-all-sharing");
|
||||
|
||||
assertEquals("block-all-sharing", service.getSnapshotBlockPublicAccessState("us-east-1"));
|
||||
assertEquals("unblocked", service.getSnapshotBlockPublicAccessState("eu-west-1"));
|
||||
|
||||
service.enableSnapshotBlockPublicAccess("eu-west-1", "block-new-sharing");
|
||||
assertEquals("block-all-sharing", service.getSnapshotBlockPublicAccessState("us-east-1"));
|
||||
assertEquals("block-new-sharing", service.getSnapshotBlockPublicAccessState("eu-west-1"));
|
||||
|
||||
service.disableSnapshotBlockPublicAccess("eu-west-1");
|
||||
assertEquals("block-all-sharing", service.getSnapshotBlockPublicAccessState("us-east-1"));
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class Ec2VolumeKmsKeyIdTest {
|
||||
mock(Ec2PortForwardManager.class), new AmiImageResolver(imageCatalog), imageCatalog,
|
||||
new Ec2InstanceTypeCatalog(), new MemoryFactory());
|
||||
handler = new Ec2QueryHandler(service, mock(EmulatorConfig.class), mock(FlowLogService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2SnapshotBlockPublicAccessService.class),
|
||||
mock(Ec2EbsEncryptionService.class), mock(Ec2BlockPublicAccessService.class),
|
||||
mock(Ec2IpamService.class), new RegionResolver(REGION, "000000000000"));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user