feat(efs): add Elastic File System (file systems, mount targets, access points) (#2371)

* chore(efs): initialize service structure

* feat: implement EFS service models for file system and mount target management

* feat(efs): implement EFS metadata service emulator

This introduces support for the AWS Elastic File System (EFS) service, handling the control plane operations across the 2015-02-01 REST API.

- Scaffolded and generated EFS DTO models with Jackson PascalCase mapping

Created EfsService with StorageBackend capabilities for File Systems, Mount Targets, Access Points, and Policies
Created EfsController for all mapped REST-JSON routes under /2015-02-01
Registered EFS in the global EmulatorConfig and ResolvedServiceCatalog
Added comprehensive EfsIntegrationTest verifying end-to-end API lifecycle
Created EFS service documentation in docs/services/efs.md

* feat(efs): implement EFS metadata service emulator

This introduces support for the AWS Elastic File System (EFS) service, handling the control plane operations across the 2015-02-01 REST API.

- Scaffolded and generated EFS DTO models with Jackson PascalCase mapping
- Created EfsService with StorageBackend capabilities for File Systems, Mount Targets, Access Points, and Policies
- Created EfsController for all mapped REST-JSON routes under /2015-02-01
- Registered EFS in the global EmulatorConfig and ResolvedServiceCatalog
- Added comprehensive EfsIntegrationTest verifying end-to-end API lifecycle
- Created EFS service documentation in docs/services/efs.md

* fix(efs): address code review comments

- Fixed describe listings to be appropriately region-scoped
- Ensured idempotency token caching for AccessPoint and FileSystem creations
- Altered creation timestamps to use standard epoch seconds

* fix(efs): register models for reflection to satisfy native-image requirements

* fix(efs): resolve remaining review comments and add documentation

- Prevented file system deletion when mount targets exist
- Cleaned up policies and access points upon file system deletion
- Validated parent file system exists during Access Point creation
- Added proper logging for tolerated exceptions during mount target deletion
- Created missing documentation page docs/services/efs.md

* fix(efs): prevent deletion races by locking on file system ID

Wraps all state-mutating operations on file systems and their dependent resources in synchronized blocks keyed by the file system ID. This guarantees that CreateMountTarget, CreateAccessPoint, and similar operations cannot race with DeleteFileSystem, satisfying the Greptile review for P1 Deletion races dependent creation.

* fix(efs): resolve additional concurrency bugs identified by Greptile

- Prevents duplicate access point creation when concurrent requests reuse the same ClientToken across different file systems by adding a dedicated token lock.
- Prevents resurrection of deleted mount targets by wrapping modifyMountTargetSecurityGroups and deleteMountTarget in target-specific locks.

* fix(efs): enforce idempotent parameter matching for access points

* fix(efs): enforce parameter matching for idempotent creation requests

- Compares all parameters in CreateFileSystem (PerformanceMode, ThroughputMode, Encrypted, KmsKeyId, ProvisionedThroughputInMibps) when CreationToken matches
- Compares all parameters in CreateAccessPoint (FileSystemId, PosixUser, RootDirectory) when ClientToken matches
- Throws IdempotentParameterMismatch if parameters differ on a retried token, satisfying Greptile bot review

* fix(efs): enforce idempotent parameter matching for nested access point fields

- Compares PosixUser.SecondaryGids
- Compares RootDirectory.CreationInfo (OwnerUid, OwnerGid, Permissions)
- Throws IdempotentParameterMismatch if nested parameters differ on a retried token, satisfying Greptile bot review

* fix(efs): enforce idempotent parameter matching for default field omission and tags

- Treats null PerformanceMode as 'generalPurpose' for equality checks
- Treats null ThroughputMode as 'bursting' for equality checks
- Treats null Encrypted as false for equality checks
- Strictly compares tag lists in both CreateFileSystem and CreateAccessPoint
- Throws IdempotentParameterMismatch if these differ on a retried token, satisfying Greptile bot review

* fix(efs): override equals and hashCode on Tag model to enable correct idempotency comparison

- Resolves issue where identical tag values on retries were evaluated as mismatched due to object identity comparison
- Satisfies Greptile bot review for Tag idempotency checks

* fix(efs): enforce idempotent parameter matching for AvailabilityZoneName and Backup settings

- Persists AvailabilityZoneName (and derived ID) on the FileSystem during creation if supplied
- Implicitly creates an ENABLED/DISABLED BackupPolicy during CreateFileSystem to match AWS default behavior
- Compares AvailabilityZoneName on retry
- Evaluates Backup request flag against stored BackupPolicy status
- Satisfies final Greptile bot review for missing idempotency parameters

* fix(efs): evaluate creation-time backup configuration rather than current mutable policy during retries

- Adds originalBackupParameter to FileSystem model to immutably capture the configuration at creation time
- Refactors idempotency check to evaluate this stored value rather than querying the potentially modified live BackupPolicy
- Addresses Greptile P1 defect where PutBackupPolicy broke CreateFileSystem retries

* fix(efs): resolve backup retry snapshot persistence across emulator restarts

- Replaces @JsonIgnore FileSystem property with a dedicated originalBackupStore
- Ensures the original backup parameter is properly persisted and reloaded from disk
- Maintains AWS API contract fidelity while preventing IdempotentParameterMismatch on restarts

* fix(config): resolve EmrServerless and EFS configuration syntax

* fix(efs): prevent stale mount targets by deleting them inside the file system lock

* fix(efs): correct file-system policy endpoint path to singular /policy

* fix(efs): apply query string filters correctly for describe operations

* fix: align EFS emulator with AWS specifications

- Fix idempotency matching logic for CreateFileSystem and CreateAccessPoint
- Implement modern TagResource, UntagResource, and ListTagsForResource APIs
- Dynamically resolve regions and ARNs via RegionResolver
- Detect mount target subnet conflicts and dynamically resolve AZs
- Remove unused obsolete EFS model classes
- Ensure UpdateFileSystem returns 202 Accepted status code

* docs: generate EFS action table from controller

Resolves 'make docs-check' failure by injecting the floci:actions sentinel markers so the automated docs tool can maintain the supported actions list.

* fix: align EFS emulator with AWS specifications

- Fix idempotency matching logic for CreateFileSystem and CreateAccessPoint
- Implement modern TagResource, UntagResource, and ListTagsForResource APIs
- Dynamically resolve regions and ARNs via RegionResolver
- Detect mount target subnet conflicts and dynamically resolve AZs
- Remove unused obsolete EFS model classes
- Ensure UpdateFileSystem returns 202 Accepted status code

* docs: generate EFS action table from controller

Resolves 'make docs-check' failure by injecting the floci:actions sentinel markers so the automated docs tool can maintain the supported actions list.

* fix: prevent stale count on mount target deletion failure

Removes the generic catch block in deleteMountTarget so that an unexpected exception during the file system update causes the entire operation to fail, leaving the mount target intact instead of silently deleting it and causing an inconsistent parent count.

* fix: store original creation requests to prevent false idempotency conflicts

When a file system or access point is updated or retagged, its mutable state changes. Retries using the original creation token were incorrectly compared against this mutated state, causing IdempotentParameterMismatch conflicts. This commit introduces dedicated storage backends to retain the original CreateFileSystemRequest and CreateAccessPointRequest, ensuring that idempotent retries correctly compare their parameters against the original request rather than the current mutated state.

* fix: store original creation requests to prevent false idempotency conflicts

When a file system or access point is updated or retagged, its mutable state changes. Retries using the original creation token were incorrectly compared against this mutated state, causing IdempotentParameterMismatch conflicts. This commit introduces dedicated storage backends to retain the original CreateFileSystemRequest and CreateAccessPointRequest, ensuring that idempotent retries correctly compare their parameters against the original request rather than the current mutated state.

* refactor: remove unused idempotent parameter stores in EFS

Dropping originalFileSystemRequestStore, originalAccessPointRequestStore, and originalBackupStore, as parameter matching is no longer performed by the EFS emulator. These stores were persistent and written to on every create but never read, unnecessarily keeping state files around.

* fix(efs): resolve compliance issues and reviewer feedback

- Populate AccessPointDescription.Name from tags during create and describe
- Return 404 FileSystemNotFound for unknown IDs or CreationTokens in DescribeFileSystems
- Implement Marker/MaxItems pagination for DescribeTags
- Refactor AZ-ID generation to match exact AWS shapes (e.g. usw2-az1)
- Clear ProvisionedThroughputInMibps on transition to elastic/bursting mode
- Reject update requests setting ProvisionedThroughputInMibps on non-provisioned filesystems
- Add trailing newline to ThroughputMode.java
- Expand integration tests for ThroughputMode transitions

---------

Signed-off-by: NAMAN JAIN <naman.049259@tmu.ac.in>
This commit is contained in:
NAMAN JAIN authored and GitHub committed 2026-08-25 19:48:38 -05:00
1 parent fd78ae4f4b
commit 943b4c1b45
57 files changed
+2957 -1

No files matched your search

@@ -462,6 +462,11 @@
<version>1.1.10.8</version>
<scope>test</scope>
</dependency>
<!-- EFS client -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>efs</artifactId>
</dependency>
</dependencies>
<build>
@@ -58,6 +58,7 @@ import software.amazon.awssdk.services.apigatewayv2.ApiGatewayV2Client;
import software.amazon.awssdk.services.elasticache.ElastiCacheClient;
import software.amazon.awssdk.services.elasticbeanstalk.ElasticBeanstalkClient;
import software.amazon.awssdk.services.acm.AcmClient;
import software.amazon.awssdk.services.efs.EfsClient;
import software.amazon.awssdk.services.ec2.Ec2Client;
import software.amazon.awssdk.services.ecr.EcrClient;
import software.amazon.awssdk.services.bedrockagentcore.BedrockAgentCoreClient;
@@ -985,4 +986,12 @@ public final class TestFixtures {
.credentialsProvider(CREDENTIALS)
.build();
}
public static EfsClient efsClient() {
return EfsClient.builder()
.endpointOverride(ENDPOINT)
.region(REGION)
.credentialsProvider(CREDENTIALS)
.build();
}
}
@@ -0,0 +1,84 @@
package com.floci.test;
import org.junit.jupiter.api.*;
import software.amazon.awssdk.services.efs.EfsClient;
import software.amazon.awssdk.services.efs.model.*;
import static org.assertj.core.api.Assertions.*;
@DisplayName("EFS Elastic File System")
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class EfsTest {
private static EfsClient efs;
@BeforeAll
static void setup() {
efs = TestFixtures.efsClient();
}
@AfterAll
static void cleanup() {
if (efs != null) {
efs.close();
}
}
@Test
@Order(1)
void createWithElasticThroughputMode() {
String token = TestFixtures.uniqueName("efs-");
CreateFileSystemResponse response = efs.createFileSystem(r -> r
.creationToken(token)
.throughputMode(ThroughputMode.ELASTIC)
);
assertThat(response.throughputMode()).isEqualTo(ThroughputMode.ELASTIC);
assertThat(response.fileSystemId()).startsWith("fs-");
}
@Test
@Order(2)
void duplicateCreationTokenThrowsFileSystemAlreadyExists() {
String token = TestFixtures.uniqueName("efs-dup-");
CreateFileSystemResponse response1 = efs.createFileSystem(r -> r.creationToken(token));
String fsId = response1.fileSystemId();
FileSystemAlreadyExistsException ex = catchThrowableOfType(
() -> efs.createFileSystem(r -> r.creationToken(token).throughputMode(ThroughputMode.PROVISIONED)),
FileSystemAlreadyExistsException.class
);
assertThat(ex).isNotNull();
assertThat(ex.fileSystemId()).isEqualTo(fsId);
}
@Test
@Order(3)
void duplicateClientTokenThrowsAccessPointAlreadyExists() {
String fsToken = TestFixtures.uniqueName("efs-ap-");
CreateFileSystemResponse fsResponse = efs.createFileSystem(r -> r.creationToken(fsToken));
String fsId = fsResponse.fileSystemId();
String clientToken = TestFixtures.uniqueName("ap-dup-");
CreateAccessPointResponse apResponse1 = efs.createAccessPoint(r -> r
.fileSystemId(fsId)
.clientToken(clientToken)
);
String apId = apResponse1.accessPointId();
AccessPointAlreadyExistsException ex = catchThrowableOfType(
() -> efs.createAccessPoint(r -> r
.fileSystemId(fsId)
.clientToken(clientToken)
.tags(software.amazon.awssdk.services.efs.model.Tag.builder().key("foo").value("bar").build())
),
AccessPointAlreadyExistsException.class
);
assertThat(ex).isNotNull();
assertThat(ex.accessPointId()).isEqualTo(apId);
}
}
@@ -233,6 +233,9 @@ floci:
ec2:
enabled: true
efs:
enabled: true
ecs:
enabled: true
mock: false # true = tasks go to RUNNING without Docker (useful for CI)
+43
View File
@@ -0,0 +1,43 @@
# Elastic File System (EFS)
**Protocol:** REST JSON
**Endpoint:** `http://localhost:4566/2015-02-01/...`
The EFS emulator provides a metadata control plane for file systems, mount targets, access points, and policies across the `2015-02-01` API.
## Supported Operations
<!-- floci:actions:start -->
| Action | Description |
| --- | --- |
| `CreateFileSystem` | - |
| `DescribeFileSystems` | - |
| `UpdateFileSystem` | - |
| `DeleteFileSystem` | - |
| `CreateTags` | - |
| `DescribeTags` | - |
| `DeleteTags` | - |
| `TagResource` | - |
| `UntagResource` | - |
| `ListTagsForResource` | - |
| `CreateMountTarget` | - |
| `DescribeMountTargets` | - |
| `DeleteMountTarget` | - |
| `DescribeMountTargetSecurityGroups` | - |
| `ModifyMountTargetSecurityGroups` | - |
| `CreateAccessPoint` | - |
| `DescribeAccessPoints` | - |
| `DeleteAccessPoint` | - |
| `PutFileSystemPolicy` | - |
| `DescribeFileSystemPolicy` | - |
| `DeleteFileSystemPolicy` | - |
| `PutBackupPolicy` | - |
| `DescribeBackupPolicy` | - |
| `PutLifecycleConfiguration` | - |
| `DescribeLifecycleConfiguration` | - |
<!-- floci:actions:end -->
## Limitations
- **Metadata Only**: Floci provides an EFS API simulation (the control plane) so you can provision file systems for your ECS tasks and Lambda functions. It does not provide an actual NFSv4.1 data plane endpoint. Reading or writing files via standard file-system mounts will fail.
- **Lifecycle Evaluation**: Lifecycle policies are saved but no background worker evaluates them to move data across storage classes. Transition fields will remain static.
- **Backup**: Backup policies are recorded, but Floci does not currently interface with the AWS Backup emulator to generate real snapshot resources.
+1
View File
@@ -58,6 +58,7 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac
| [EMR Serverless](emr-serverless.md) | `/applications/*` | REST JSON | 7 |
| [Data Firehose](firehose.md) | `POST /` + `X-Amz-Target: Firehose_20150804.*` | JSON 1.1 | 6 |
| [ECS](ecs.md) | `POST /` + `X-Amz-Target: AmazonEC2ContainerServiceV20141113.*` | JSON 1.1 | 58 |
| [EFS](efs.md) | `/2015-02-01/...` | REST JSON | 17 |
| [EC2](ec2.md) | `POST /` with `Action=` param | EC2 Query | 78 |
| [Lightsail](lightsail.md) | `POST /` + `X-Amz-Target: Lightsail_20161128.*` | JSON 1.1 | 79 local responses; 161 recognized actions |
| [ACM](acm.md) | `POST /` + `X-Amz-Target: CertificateManager.*` | JSON 1.1 | 12 |
@@ -285,6 +285,7 @@ public interface EmulatorConfig {
RumStorageConfig rum();
GuardDutyStorageConfig guardduty();
EmrServerlessStorageConfig emrserverless();
EfsStorageConfig efs();
}
interface SsmStorageConfig {
@@ -528,6 +529,13 @@ public interface EmulatorConfig {
long flushIntervalMs();
}
interface EfsStorageConfig {
Optional<String> mode();
@WithDefault("5000")
long flushIntervalMs();
}
interface CodeDeployStorageConfig {
Optional<String> mode();
@@ -638,6 +646,7 @@ public interface EmulatorConfig {
RumServiceConfig rum();
GuardDutyServiceConfig guardduty();
EmrServerlessServiceConfig emrserverless();
EfsServiceConfig efs();
}
interface IotServiceConfig {
@@ -681,6 +690,11 @@ public interface EmulatorConfig {
boolean enabled();
}
interface EfsServiceConfig {
@WithDefault("true")
boolean enabled();
}
interface LightsailServiceConfig {
@WithDefault("true")
boolean enabled();
@@ -33,6 +33,7 @@ import io.github.hectorvent.floci.services.guardduty.GuardDutyController;
import io.github.hectorvent.floci.services.rum.RumController;
import io.github.hectorvent.floci.services.s3vectors.S3VectorsController;
import io.github.hectorvent.floci.services.s3tables.S3TablesController;
import io.github.hectorvent.floci.services.efs.EfsController;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
@@ -490,7 +491,13 @@ public class ResolvedServiceCatalog {
storageMode(config.storage().services().guardduty().mode(), config.storage().mode()),
config.storage().services().guardduty().flushIntervalMs(), null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("guardduty"), Set.of(), Set.of(GuardDutyController.class))
Set.of(), Set.of("guardduty"), Set.of(), Set.of(GuardDutyController.class)),
descriptor("efs", "efs", config.services().efs().enabled(), true,
"efs",
storageMode(config.storage().services().efs().mode(), config.storage().mode()),
config.storage().services().efs().flushIntervalMs(), null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("elasticfilesystem"), Set.of(), Set.of(EfsController.class))
));
}
@@ -0,0 +1,282 @@
package io.github.hectorvent.floci.services.efs;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.services.efs.model.*;
import jakarta.inject.Inject;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@Path("/2015-02-01")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class EfsController {
private final EfsService efsService;
private final RegionResolver regionResolver;
@Inject
public EfsController(EfsService efsService, RegionResolver regionResolver) {
this.efsService = efsService;
this.regionResolver = regionResolver;
}
// --- File Systems ---
@POST
@Path("/file-systems")
public Response createFileSystem(@Context HttpHeaders headers, CreateFileSystemRequest request) {
String region = regionResolver.resolveRegion(headers);
FileSystem fs = efsService.createFileSystem(request, region);
return Response.status(201).entity(fs).build();
}
@GET
@Path("/file-systems")
public Response describeFileSystems(@Context HttpHeaders headers, @jakarta.ws.rs.BeanParam DescribeFileSystemsRequest request) {
String region = regionResolver.resolveRegion(headers);
DescribeFileSystemsResponse response = efsService.describeFileSystems(region, request);
return Response.ok(response).build();
}
@PUT
@Path("/file-systems/{FileSystemId}")
public Response updateFileSystem(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId, UpdateFileSystemRequest request) {
String region = regionResolver.resolveRegion(headers);
FileSystem fs = efsService.updateFileSystem(region, fileSystemId, request);
return Response.status(202).entity(fs).build();
}
@DELETE
@Path("/file-systems/{FileSystemId}")
public Response deleteFileSystem(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId) {
String region = regionResolver.resolveRegion(headers);
efsService.deleteFileSystem(region, fileSystemId);
return Response.noContent().build();
}
// --- Tags ---
@POST
@Path("/create-tags/{FileSystemId}")
public Response createTags(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId, CreateTagsRequest request) {
String region = regionResolver.resolveRegion(headers);
efsService.createTags(region, fileSystemId, request);
return Response.noContent().build();
}
@GET
@Path("/tags/{FileSystemId}")
public Response describeTags(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId, @jakarta.ws.rs.BeanParam DescribeTagsRequest request) {
String region = regionResolver.resolveRegion(headers);
FileSystem fs = efsService.getFileSystem(region, fileSystemId);
java.util.List<Tag> tags = fs.getTags() != null ? fs.getTags() : new java.util.ArrayList<>();
int maxItems = request.getMaxItems() != null ? request.getMaxItems() : 100;
int startIndex = 0;
if (request.getMarker() != null && !request.getMarker().isEmpty()) {
for (int i = 0; i < tags.size(); i++) {
if (tags.get(i).getKey().equals(request.getMarker())) {
startIndex = i + 1;
break;
}
}
}
java.util.List<Tag> paginated = new java.util.ArrayList<>();
String nextMarker = null;
for (int i = startIndex; i < tags.size(); i++) {
if (paginated.size() >= maxItems) {
nextMarker = tags.get(i - 1).getKey();
break;
}
paginated.add(tags.get(i));
}
DescribeTagsResponse res = new DescribeTagsResponse();
res.setTags(paginated);
res.setMarker(request.getMarker());
res.setNextMarker(nextMarker);
return Response.ok(res).build();
}
@POST
@Path("/delete-tags/{FileSystemId}")
public Response deleteTags(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId, DeleteTagsRequest request) {
String region = regionResolver.resolveRegion(headers);
efsService.deleteTags(region, fileSystemId, request);
return Response.noContent().build();
}
@POST
@Path("/resource-tags/{ResourceId}")
public Response tagResource(@Context HttpHeaders headers, @PathParam("ResourceId") String resourceId, TagResourceRequest request) {
String region = regionResolver.resolveRegion(headers);
request.setResourceId(resourceId);
efsService.tagResource(region, request);
return Response.ok().build();
}
@DELETE
@Path("/resource-tags/{ResourceId}")
public Response untagResource(@Context HttpHeaders headers, @PathParam("ResourceId") String resourceId, @jakarta.ws.rs.BeanParam UntagResourceRequest request) {
String region = regionResolver.resolveRegion(headers);
efsService.untagResource(region, resourceId, request.getTagKeys());
return Response.ok().build();
}
@GET
@Path("/resource-tags/{ResourceId}")
public Response listTagsForResource(@Context HttpHeaders headers, @PathParam("ResourceId") String resourceId) {
String region = regionResolver.resolveRegion(headers);
return Response.ok(efsService.listTagsForResource(region, resourceId)).build();
}
// --- Mount Targets ---
@POST
@Path("/mount-targets")
public Response createMountTarget(@Context HttpHeaders headers, CreateMountTargetRequest request) {
String region = regionResolver.resolveRegion(headers);
MountTarget mt = efsService.createMountTarget(request, region);
return Response.status(200).entity(mt).build();
}
@GET
@Path("/mount-targets")
public Response describeMountTargets(@Context HttpHeaders headers, @jakarta.ws.rs.BeanParam DescribeMountTargetsRequest request) {
String region = regionResolver.resolveRegion(headers);
DescribeMountTargetsResponse response = efsService.describeMountTargets(region, request);
return Response.ok(response).build();
}
@DELETE
@Path("/mount-targets/{MountTargetId}")
public Response deleteMountTarget(@Context HttpHeaders headers, @PathParam("MountTargetId") String mountTargetId) {
String region = regionResolver.resolveRegion(headers);
efsService.deleteMountTarget(region, mountTargetId);
return Response.noContent().build();
}
@GET
@Path("/mount-targets/{MountTargetId}/security-groups")
public Response describeMountTargetSecurityGroups(@Context HttpHeaders headers, @PathParam("MountTargetId") String mountTargetId) {
String region = regionResolver.resolveRegion(headers);
return Response.ok(efsService.describeMountTargetSecurityGroups(region, mountTargetId)).build();
}
@PUT
@Path("/mount-targets/{MountTargetId}/security-groups")
public Response modifyMountTargetSecurityGroups(@Context HttpHeaders headers, @PathParam("MountTargetId") String mountTargetId, ModifyMountTargetSecurityGroupsRequest request) {
String region = regionResolver.resolveRegion(headers);
efsService.modifyMountTargetSecurityGroups(region, mountTargetId, request);
return Response.noContent().build();
}
// --- Access Points ---
@POST
@Path("/access-points")
public Response createAccessPoint(@Context HttpHeaders headers, CreateAccessPointRequest request) {
String region = regionResolver.resolveRegion(headers);
AccessPointDescription ap = efsService.createAccessPoint(region, request);
return Response.status(200).entity(ap).build();
}
@GET
@Path("/access-points")
public Response describeAccessPoints(@Context HttpHeaders headers, @jakarta.ws.rs.QueryParam("FileSystemId") String fileSystemId, @jakarta.ws.rs.QueryParam("AccessPointId") String accessPointId) {
String region = regionResolver.resolveRegion(headers);
DescribeAccessPointsResponse res = new DescribeAccessPointsResponse();
res.setAccessPoints(efsService.describeAccessPoints(region, fileSystemId, accessPointId));
return Response.ok(res).build();
}
@DELETE
@Path("/access-points/{AccessPointId}")
public Response deleteAccessPoint(@Context HttpHeaders headers, @PathParam("AccessPointId") String accessPointId) {
String region = regionResolver.resolveRegion(headers);
efsService.deleteAccessPoint(region, accessPointId);
return Response.noContent().build();
}
// --- Policies ---
@PUT
@Path("/file-systems/{FileSystemId}/policy")
public Response putFileSystemPolicy(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId, PutFileSystemPolicyRequest request) {
String region = regionResolver.resolveRegion(headers);
efsService.putFileSystemPolicy(region, fileSystemId, request.getPolicy());
PutFileSystemPolicyResponse res = new PutFileSystemPolicyResponse();
res.setFileSystemId(fileSystemId);
res.setPolicy(request.getPolicy());
return Response.ok(res).build();
}
@GET
@Path("/file-systems/{FileSystemId}/policy")
public Response describeFileSystemPolicy(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId) {
String region = regionResolver.resolveRegion(headers);
String policy = efsService.getFileSystemPolicy(region, fileSystemId);
DescribeFileSystemPolicyResponse res = new DescribeFileSystemPolicyResponse();
res.setFileSystemId(fileSystemId);
res.setPolicy(policy);
return Response.ok(res).build();
}
@DELETE
@Path("/file-systems/{FileSystemId}/policy")
public Response deleteFileSystemPolicy(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId) {
String region = regionResolver.resolveRegion(headers);
efsService.deleteFileSystemPolicy(region, fileSystemId);
return Response.ok().build();
}
@PUT
@Path("/file-systems/{FileSystemId}/backup-policy")
public Response putBackupPolicy(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId, PutBackupPolicyRequest request) {
String region = regionResolver.resolveRegion(headers);
efsService.putBackupPolicy(region, fileSystemId, request.getBackupPolicy());
PutBackupPolicyResponse res = new PutBackupPolicyResponse();
res.setBackupPolicy(request.getBackupPolicy());
return Response.ok(res).build();
}
@GET
@Path("/file-systems/{FileSystemId}/backup-policy")
public Response describeBackupPolicy(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId) {
String region = regionResolver.resolveRegion(headers);
BackupPolicy policy = efsService.getBackupPolicy(region, fileSystemId);
PutBackupPolicyResponse res = new PutBackupPolicyResponse();
res.setBackupPolicy(policy);
return Response.ok(res).build();
}
@PUT
@Path("/file-systems/{FileSystemId}/lifecycle-configuration")
public Response putLifecycleConfiguration(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId, PutLifecycleConfigurationRequest request) {
String region = regionResolver.resolveRegion(headers);
efsService.putLifecycleConfiguration(region, fileSystemId, request.getLifecyclePolicies());
PutLifecycleConfigurationResponse res = new PutLifecycleConfigurationResponse();
res.setLifecyclePolicies(request.getLifecyclePolicies());
return Response.ok(res).build();
}
@GET
@Path("/file-systems/{FileSystemId}/lifecycle-configuration")
public Response describeLifecycleConfiguration(@Context HttpHeaders headers, @PathParam("FileSystemId") String fileSystemId) {
String region = regionResolver.resolveRegion(headers);
PutLifecycleConfigurationResponse res = new PutLifecycleConfigurationResponse();
res.setLifecyclePolicies(efsService.getLifecycleConfiguration(region, fileSystemId));
return Response.ok(res).build();
}
}
@@ -0,0 +1,51 @@
package io.github.hectorvent.floci.services.efs;
import io.github.hectorvent.floci.core.common.AwsException;
import jakarta.ws.rs.core.Response.Status;
public class EfsException extends AwsException {
public EfsException(Status status, String errorCode, String message) {
super(errorCode, message, status.getStatusCode());
}
public EfsException(Status status, String errorCode, String message, java.util.Map<String, Object> extendedData) {
super(errorCode, message, status.getStatusCode(), extendedData);
}
public static EfsException fileSystemAlreadyExists(String token, String fileSystemId) {
return new EfsException(Status.CONFLICT, "FileSystemAlreadyExists", "File system with creation token " + token + " already exists.", java.util.Map.of("FileSystemId", fileSystemId));
}
public static EfsException fileSystemNotFound(String fileSystemId) {
return new EfsException(Status.NOT_FOUND, "FileSystemNotFound", "File system " + fileSystemId + " does not exist.");
}
public static EfsException fileSystemInUse(String fileSystemId) {
return new EfsException(Status.CONFLICT, "FileSystemInUse", "File system " + fileSystemId + " is in use.");
}
public static EfsException mountTargetNotFound(String mountTargetId) {
return new EfsException(Status.NOT_FOUND, "MountTargetNotFound", "Mount target " + mountTargetId + " does not exist.");
}
public static EfsException mountTargetConflict(String message) {
return new EfsException(Status.CONFLICT, "MountTargetConflict", message);
}
public static EfsException accessPointAlreadyExists(String token, String accessPointId) {
return new EfsException(Status.CONFLICT, "AccessPointAlreadyExists", "Access point with client token " + token + " already exists.", java.util.Map.of("AccessPointId", accessPointId));
}
public static EfsException accessPointNotFound(String accessPointId) {
return new EfsException(Status.NOT_FOUND, "AccessPointNotFound", "Access point " + accessPointId + " does not exist.");
}
public static EfsException policyNotFound(String fileSystemId) {
return new EfsException(Status.NOT_FOUND, "PolicyNotFound", "Policy for file system " + fileSystemId + " does not exist.");
}
public static EfsException badRequest(String message) {
return new EfsException(Status.BAD_REQUEST, "BadRequest", message);
}
}
@@ -0,0 +1,597 @@
package io.github.hectorvent.floci.services.efs;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.core.common.Resettable;
import io.github.hectorvent.floci.services.efs.model.*;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import io.github.hectorvent.floci.core.common.RegionResolver;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.concurrent.ConcurrentHashMap;
import org.jboss.logging.Logger;
@ApplicationScoped
public class EfsService implements Resettable {
private static final Logger LOG = Logger.getLogger(EfsService.class);
private final StorageBackend<String, FileSystem> fileSystemStore;
private final StorageBackend<String, MountTarget> mountTargetStore;
private final StorageBackend<String, AccessPointDescription> accessPointStore;
private final StorageBackend<String, String> fileSystemPolicyStore;
private final StorageBackend<String, BackupPolicy> backupPolicyStore;
private final StorageBackend<String, List<LifecyclePolicy>> lifecycleConfigurationStore;
private final ConcurrentHashMap<String, Object> syncLocks = new ConcurrentHashMap<>();
private final RegionResolver regionResolver;
private Object lockFor(String key) {
return syncLocks.computeIfAbsent(key, k -> new Object());
}
@Inject
public EfsService(StorageFactory storageFactory, RegionResolver regionResolver) {
this.regionResolver = regionResolver;
this.fileSystemStore = storageFactory.create("efs", "efs-filesystems.json",
new com.fasterxml.jackson.core.type.TypeReference<java.util.Map<String, FileSystem>>() {});
this.mountTargetStore = storageFactory.create("efs", "efs-mounttargets.json",
new com.fasterxml.jackson.core.type.TypeReference<java.util.Map<String, MountTarget>>() {});
this.accessPointStore = storageFactory.create("efs", "efs-accesspoints.json",
new com.fasterxml.jackson.core.type.TypeReference<java.util.Map<String, AccessPointDescription>>() {});
this.fileSystemPolicyStore = storageFactory.create("efs", "efs-policies.json",
new com.fasterxml.jackson.core.type.TypeReference<java.util.Map<String, String>>() {});
this.backupPolicyStore = storageFactory.create("efs", "efs-backuppolicies.json",
new com.fasterxml.jackson.core.type.TypeReference<java.util.Map<String, BackupPolicy>>() {});
this.lifecycleConfigurationStore = storageFactory.create("efs", "efs-lifecycle.json",
new com.fasterxml.jackson.core.type.TypeReference<java.util.Map<String, List<LifecyclePolicy>>>() {});
}
@Override
public void clear() {
fileSystemStore.clear();
mountTargetStore.clear();
accessPointStore.clear();
fileSystemPolicyStore.clear();
backupPolicyStore.clear();
lifecycleConfigurationStore.clear();
syncLocks.clear();
}
// --- File Systems ---
public FileSystem createFileSystem(CreateFileSystemRequest request, String region) {
String token = request.getCreationToken() != null ? request.getCreationToken() : UUID.randomUUID().toString();
synchronized (lockFor(region + "::create::" + token)) {
for (FileSystem existing : fileSystemStore.scan(k -> k.startsWith(region + "::"))) {
if (token.equals(existing.getCreationToken())) {
throw EfsException.fileSystemAlreadyExists(existing.getCreationToken(), existing.getFileSystemId());
}
}
String fsId = "fs-" + UUID.randomUUID().toString().replace("-", "").substring(0, 17);
String regionKey = regionKey(region, fsId);
FileSystem fs = new FileSystem();
fs.setFileSystemId(fsId);
fs.setCreationToken(token);
fs.setCreationTime(Instant.now().getEpochSecond());
fs.setLifeCycleState(LifeCycleState.available.name());
fs.setFileSystemArn(regionResolver.buildArn("elasticfilesystem", region, "file-system/" + fsId));
fs.setOwnerId(regionResolver.getAccountId());
fs.setNumberOfMountTargets(0);
fs.setPerformanceMode(request.getPerformanceMode() != null ? request.getPerformanceMode().name() : "generalPurpose");
fs.setThroughputMode(request.getThroughputMode() != null ? request.getThroughputMode().name() : "bursting");
if ("PROVISIONED".equalsIgnoreCase(fs.getThroughputMode()) && request.getProvisionedThroughputInMibps() != null) {
fs.setProvisionedThroughputInMibps(request.getProvisionedThroughputInMibps());
}
fs.setEncrypted(request.getEncrypted() != null ? request.getEncrypted() : false);
fs.setKmsKeyId(request.getKmsKeyId());
if (request.getAvailabilityZoneName() != null) {
fs.setAvailabilityZoneName(request.getAvailabilityZoneName());
fs.setAvailabilityZoneId(generateAzId(request.getAvailabilityZoneName()));
}
if (request.getTags() != null) {
fs.setTags(new ArrayList<>(request.getTags()));
} else {
fs.setTags(new ArrayList<>());
}
FileSystemSize size = new FileSystemSize();
size.setValue(0L);
size.setValueInIA(0L);
size.setValueInStandard(0L);
fs.setSizeInBytes(size);
fileSystemStore.put(regionKey, fs);
BackupPolicy bp = new BackupPolicy();
bp.setStatus(request.getBackup() != null && !request.getBackup() ? "DISABLED" : "ENABLED");
backupPolicyStore.put(regionKey, bp);
return fs;
}
}
public DescribeFileSystemsResponse describeFileSystems(String region, DescribeFileSystemsRequest request) {
List<FileSystem> results = fileSystemStore.scan(k -> k.startsWith(region + "::")).stream()
.filter(fs -> request.getFileSystemId() == null
|| request.getFileSystemId().equals(fs.getFileSystemId()))
.filter(fs -> request.getCreationToken() == null
|| request.getCreationToken().equals(fs.getCreationToken()))
.map(fs -> {
if (fs.getTags() != null) {
fs.getTags().stream().filter(t -> "Name".equals(t.getKey())).findFirst().ifPresent(tag -> {
fs.setName(tag.getValue());
});
}
return fs;
})
.sorted(Comparator.comparing(FileSystem::getFileSystemId))
.collect(Collectors.toList());
if (results.isEmpty()) {
if (request.getFileSystemId() != null) {
throw EfsException.fileSystemNotFound(request.getFileSystemId());
}
if (request.getCreationToken() != null) {
throw EfsException.fileSystemNotFound(request.getCreationToken());
}
}
int maxItems = request.getMaxItems() != null ? request.getMaxItems() : 100;
int startIndex = 0;
if (request.getMarker() != null && !request.getMarker().isEmpty()) {
for (int i = 0; i < results.size(); i++) {
if (results.get(i).getFileSystemId().equals(request.getMarker())) {
startIndex = i + 1;
break;
}
}
}
List<FileSystem> paginated = new ArrayList<>();
String nextMarker = null;
for (int i = startIndex; i < results.size(); i++) {
if (paginated.size() >= maxItems) {
nextMarker = results.get(i - 1).getFileSystemId();
break;
}
paginated.add(results.get(i));
}
DescribeFileSystemsResponse response = new DescribeFileSystemsResponse();
response.setFileSystems(paginated);
response.setMarker(request.getMarker());
response.setNextMarker(nextMarker);
return response;
}
public FileSystem getFileSystem(String region, String fileSystemId) {
FileSystem fs = fileSystemStore.get(regionKey(region, fileSystemId)).orElse(null);
if (fs == null) {
throw EfsException.fileSystemNotFound(fileSystemId);
}
return fs;
}
public FileSystem updateFileSystem(String region, String fileSystemId, UpdateFileSystemRequest request) {
synchronized (lockFor(regionKey(region, fileSystemId))) {
FileSystem fs = getFileSystem(region, fileSystemId);
if (request.getThroughputMode() != null) {
String mode = request.getThroughputMode().name();
fs.setThroughputMode(mode);
if (!"PROVISIONED".equalsIgnoreCase(mode)) {
fs.setProvisionedThroughputInMibps(null);
}
}
if (request.getProvisionedThroughputInMibps() != null) {
if (!"PROVISIONED".equalsIgnoreCase(fs.getThroughputMode())) {
throw EfsException.badRequest("ProvisionedThroughputInMibps is only valid with PROVISIONED throughput mode.");
}
fs.setProvisionedThroughputInMibps(request.getProvisionedThroughputInMibps());
}
fileSystemStore.put(regionKey(region, fileSystemId), fs);
return fs;
}
}
public void deleteFileSystem(String region, String fileSystemId) {
String key = regionKey(region, fileSystemId);
synchronized (lockFor(key)) {
if (fileSystemStore.get(key).isEmpty()) {
throw EfsException.fileSystemNotFound(fileSystemId);
}
DescribeMountTargetsRequest descReq = new DescribeMountTargetsRequest();
descReq.setFileSystemId(fileSystemId);
List<MountTarget> mountTargets = describeMountTargets(region, descReq).getMountTargets();
if (!mountTargets.isEmpty()) {
throw EfsException.fileSystemInUse(fileSystemId);
}
// Clean up access points
List<AccessPointDescription> accessPoints = describeAccessPoints(region, fileSystemId, null);
for (AccessPointDescription ap : accessPoints) {
accessPointStore.delete(regionKey(region, ap.getAccessPointId()));
}
// Clean up policies
fileSystemPolicyStore.delete(key);
backupPolicyStore.delete(key);
lifecycleConfigurationStore.delete(key);
fileSystemStore.delete(key);
}
}
// --- Tags ---
public void createTags(String region, String fileSystemId, CreateTagsRequest request) {
synchronized (lockFor(regionKey(region, fileSystemId))) {
FileSystem fs = getFileSystem(region, fileSystemId);
List<Tag> existing = fs.getTags();
if (request.getTags() != null) {
for (Tag newTag : request.getTags()) {
existing.removeIf(t -> t.getKey().equals(newTag.getKey()));
existing.add(newTag);
}
}
fileSystemStore.put(regionKey(region, fileSystemId), fs);
}
}
public void deleteTags(String region, String fileSystemId, DeleteTagsRequest request) {
synchronized (lockFor(regionKey(region, fileSystemId))) {
FileSystem fs = getFileSystem(region, fileSystemId);
if (request.getTagKeys() != null) {
fs.getTags().removeIf(t -> request.getTagKeys().contains(t.getKey()));
}
fileSystemStore.put(regionKey(region, fileSystemId), fs);
}
}
public void tagResource(String region, TagResourceRequest request) {
synchronized (lockFor(regionKey(region, request.getResourceId()))) {
List<Tag> existing = getResourceTags(region, request.getResourceId());
if (request.getTags() != null) {
for (Tag newTag : request.getTags()) {
existing.removeIf(t -> t.getKey().equals(newTag.getKey()));
existing.add(newTag);
}
}
saveResourceTags(region, request.getResourceId(), existing);
}
}
public void untagResource(String region, String resourceId, List<String> tagKeys) {
synchronized (lockFor(regionKey(region, resourceId))) {
List<Tag> existing = getResourceTags(region, resourceId);
if (tagKeys != null) {
existing.removeIf(t -> tagKeys.contains(t.getKey()));
}
saveResourceTags(region, resourceId, existing);
}
}
public ListTagsForResourceResponse listTagsForResource(String region, String resourceId) {
List<Tag> tags = getResourceTags(region, resourceId);
ListTagsForResourceResponse res = new ListTagsForResourceResponse();
res.setTags(tags);
return res;
}
private List<Tag> getResourceTags(String region, String resourceId) {
if (resourceId.startsWith("fs-")) {
return getFileSystem(region, resourceId).getTags();
} else if (resourceId.startsWith("fsap-")) {
AccessPointDescription ap = accessPointStore.get(regionKey(region, resourceId)).orElse(null);
if (ap == null) throw EfsException.accessPointNotFound(resourceId);
if (ap.getTags() == null) ap.setTags(new ArrayList<>());
return ap.getTags();
} else if (resourceId.startsWith("fsmt-")) {
MountTarget mt = mountTargetStore.get(regionKey(region, resourceId)).orElse(null);
if (mt == null) throw EfsException.mountTargetNotFound(resourceId);
// Mount targets don't natively have tags in the emulator currently, so we'll just ignore for now or return empty.
return new ArrayList<>();
}
throw EfsException.badRequest("Invalid resource ID: " + resourceId);
}
private void saveResourceTags(String region, String resourceId, List<Tag> tags) {
if (resourceId.startsWith("fs-")) {
FileSystem fs = getFileSystem(region, resourceId);
fs.setTags(tags);
fileSystemStore.put(regionKey(region, resourceId), fs);
} else if (resourceId.startsWith("fsap-")) {
AccessPointDescription ap = accessPointStore.get(regionKey(region, resourceId)).orElse(null);
if (ap != null) {
ap.setTags(tags);
accessPointStore.put(regionKey(region, resourceId), ap);
}
}
}
// --- Mount Targets ---
public MountTarget createMountTarget(CreateMountTargetRequest request, String region) {
synchronized (lockFor(regionKey(region, request.getFileSystemId()))) {
FileSystem fs = getFileSystem(region, request.getFileSystemId());
for (MountTarget existing : mountTargetStore.scan(k -> k.startsWith(region + "::"))) {
if (existing.getFileSystemId().equals(request.getFileSystemId())) {
if (existing.getSubnetId().equals(request.getSubnetId())) {
throw EfsException.mountTargetConflict("Mount target already exists in this subnet");
}
}
}
String mtId = "fsmt-" + UUID.randomUUID().toString().replace("-", "").substring(0, 17);
MountTarget mt = new MountTarget();
mt.setMountTargetId(mtId);
mt.setFileSystemId(request.getFileSystemId());
mt.setSubnetId(request.getSubnetId());
mt.setIpAddress(request.getIpAddress() != null ? request.getIpAddress() : "10.0.0.10");
mt.setLifeCycleState(LifeCycleState.available);
mt.setVpcId("vpc-12345678");
mt.setAvailabilityZoneName(region + "a");
mt.setAvailabilityZoneId(generateAzId(region + "a"));
mt.setNetworkInterfaceId("eni-" + UUID.randomUUID().toString().replace("-", "").substring(0, 17));
if (request.getSecurityGroups() != null) {
mt.setSecurityGroups(new ArrayList<>(request.getSecurityGroups()));
} else {
mt.setSecurityGroups(new ArrayList<>());
}
fs.setNumberOfMountTargets(fs.getNumberOfMountTargets() + 1);
fileSystemStore.put(regionKey(region, fs.getFileSystemId()), fs);
mountTargetStore.put(regionKey(region, mtId), mt);
return mt;
}
}
public DescribeMountTargetsResponse describeMountTargets(String region, DescribeMountTargetsRequest request) {
if (request.getFileSystemId() == null && request.getMountTargetId() == null && request.getAccessPointId() == null) {
throw EfsException.badRequest("One of FileSystemId, MountTargetId, or AccessPointId must be specified.");
}
List<MountTarget> results = mountTargetStore.scan(k -> k.startsWith(region + "::")).stream()
.filter(mt -> request.getFileSystemId() == null || mt.getFileSystemId().equals(request.getFileSystemId()))
.filter(mt -> request.getMountTargetId() == null || mt.getMountTargetId().equals(request.getMountTargetId()))
.sorted(Comparator.comparing(MountTarget::getMountTargetId))
.collect(Collectors.toList());
// If accessPointId is specified, we would need to filter by access point file system ID,
// but EFS AccessPoints resolve to a FileSystemId first.
if (request.getAccessPointId() != null) {
AccessPointDescription ap = accessPointStore.get(regionKey(region, request.getAccessPointId())).orElse(null);
if (ap != null) {
results = results.stream().filter(mt -> mt.getFileSystemId().equals(ap.getFileSystemId())).collect(Collectors.toList());
} else {
results = new ArrayList<>();
}
}
int maxItems = request.getMaxItems() != null ? request.getMaxItems() : 1000;
int startIndex = 0;
if (request.getMarker() != null && !request.getMarker().isEmpty()) {
for (int i = 0; i < results.size(); i++) {
if (results.get(i).getMountTargetId().equals(request.getMarker())) {
startIndex = i + 1;
break;
}
}
}
List<MountTarget> paginated = new ArrayList<>();
String nextMarker = null;
for (int i = startIndex; i < results.size(); i++) {
if (paginated.size() >= maxItems) {
nextMarker = results.get(i - 1).getMountTargetId();
break;
}
paginated.add(results.get(i));
}
DescribeMountTargetsResponse response = new DescribeMountTargetsResponse();
response.setMountTargets(paginated);
response.setMarker(request.getMarker());
response.setNextMarker(nextMarker);
return response;
}
public void deleteMountTarget(String region, String mountTargetId) {
String key = regionKey(region, mountTargetId);
synchronized (lockFor(key)) {
MountTarget mt = mountTargetStore.get(key).orElse(null);
if (mt == null) {
throw EfsException.mountTargetNotFound(mountTargetId);
}
try {
synchronized (lockFor(regionKey(region, mt.getFileSystemId()))) {
FileSystem fs = getFileSystem(region, mt.getFileSystemId());
fs.setNumberOfMountTargets(Math.max(0, fs.getNumberOfMountTargets() - 1));
fileSystemStore.put(regionKey(region, fs.getFileSystemId()), fs);
mountTargetStore.delete(key);
}
} catch (EfsException e) {
LOG.debug("File system " + mt.getFileSystemId() + " already deleted, skipping parent count update during mount target deletion");
mountTargetStore.delete(key);
}
}
}
public DescribeMountTargetSecurityGroupsResponse describeMountTargetSecurityGroups(String region, String mountTargetId) {
MountTarget mt = mountTargetStore.get(regionKey(region, mountTargetId)).orElse(null);
if (mt == null) {
throw EfsException.mountTargetNotFound(mountTargetId);
}
DescribeMountTargetSecurityGroupsResponse res = new DescribeMountTargetSecurityGroupsResponse();
res.setSecurityGroups(mt.getSecurityGroups());
return res;
}
public void modifyMountTargetSecurityGroups(String region, String mountTargetId, ModifyMountTargetSecurityGroupsRequest request) {
synchronized (lockFor(regionKey(region, mountTargetId))) {
MountTarget mt = mountTargetStore.get(regionKey(region, mountTargetId)).orElse(null);
if (mt == null) {
throw EfsException.mountTargetNotFound(mountTargetId);
}
if (request.getSecurityGroups() != null) {
mt.setSecurityGroups(new ArrayList<>(request.getSecurityGroups()));
}
mountTargetStore.put(regionKey(region, mountTargetId), mt);
}
}
// --- Access Points ---
public AccessPointDescription createAccessPoint(String region, CreateAccessPointRequest request) {
String token = request.getClientToken() != null ? request.getClientToken() : UUID.randomUUID().toString();
synchronized (lockFor(regionKey(region, "ap-token::" + token))) {
synchronized (lockFor(regionKey(region, request.getFileSystemId()))) {
// Validate file system exists
getFileSystem(region, request.getFileSystemId());
for (AccessPointDescription existing : accessPointStore.scan(k -> k.startsWith(region + "::"))) {
if (token.equals(existing.getClientToken())) {
throw EfsException.accessPointAlreadyExists(existing.getClientToken(), existing.getAccessPointId());
}
}
String apId = "fsap-" + UUID.randomUUID().toString().replace("-", "").substring(0, 17);
AccessPointDescription ap = new AccessPointDescription();
ap.setAccessPointId(apId);
ap.setAccessPointArn(regionResolver.buildArn("elasticfilesystem", region, "access-point/" + apId));
ap.setClientToken(token);
ap.setFileSystemId(request.getFileSystemId());
ap.setPosixUser(request.getPosixUser());
ap.setRootDirectory(request.getRootDirectory());
if (request.getTags() != null) {
ap.setTags(new ArrayList<>(request.getTags()));
ap.getTags().stream().filter(t -> "Name".equals(t.getKey())).findFirst().ifPresent(tag -> {
ap.setName(tag.getValue());
});
}
ap.setLifeCycleState(LifeCycleState.available);
ap.setOwnerId(regionResolver.getAccountId());
accessPointStore.put(regionKey(region, apId), ap);
return ap;
}
}
}
public List<AccessPointDescription> describeAccessPoints(String region, String fileSystemId, String accessPointId) {
return accessPointStore.scan(k -> k.startsWith(region + "::")).stream()
.filter(ap -> fileSystemId == null || ap.getFileSystemId().equals(fileSystemId))
.filter(ap -> accessPointId == null || ap.getAccessPointId().equals(accessPointId))
.map(ap -> {
if (ap.getTags() != null) {
ap.getTags().stream().filter(t -> "Name".equals(t.getKey())).findFirst().ifPresent(tag -> {
ap.setName(tag.getValue());
});
}
return ap;
})
.collect(Collectors.toList());
}
public void deleteAccessPoint(String region, String accessPointId) {
String key = regionKey(region, accessPointId);
AccessPointDescription ap = accessPointStore.get(key).orElse(null);
if (ap == null) {
throw EfsException.accessPointNotFound(accessPointId);
}
accessPointStore.delete(key);
}
// --- Policies ---
public void putFileSystemPolicy(String region, String fileSystemId, String policy) {
synchronized (lockFor(regionKey(region, fileSystemId))) {
getFileSystem(region, fileSystemId); // check exists
fileSystemPolicyStore.put(regionKey(region, fileSystemId), policy);
}
}
public String getFileSystemPolicy(String region, String fileSystemId) {
getFileSystem(region, fileSystemId);
String policy = fileSystemPolicyStore.get(regionKey(region, fileSystemId)).orElse(null);
if (policy == null) {
throw EfsException.policyNotFound(fileSystemId);
}
return policy;
}
public void deleteFileSystemPolicy(String region, String fileSystemId) {
synchronized (lockFor(regionKey(region, fileSystemId))) {
getFileSystem(region, fileSystemId);
fileSystemPolicyStore.delete(regionKey(region, fileSystemId));
}
}
public void putBackupPolicy(String region, String fileSystemId, BackupPolicy policy) {
synchronized (lockFor(regionKey(region, fileSystemId))) {
getFileSystem(region, fileSystemId);
backupPolicyStore.put(regionKey(region, fileSystemId), policy);
}
}
public BackupPolicy getBackupPolicy(String region, String fileSystemId) {
getFileSystem(region, fileSystemId);
BackupPolicy policy = backupPolicyStore.get(regionKey(region, fileSystemId)).orElse(null);
if (policy == null) {
policy = new BackupPolicy();
policy.setStatus("DISABLED");
}
return policy;
}
public void putLifecycleConfiguration(String region, String fileSystemId, List<LifecyclePolicy> policies) {
synchronized (lockFor(regionKey(region, fileSystemId))) {
getFileSystem(region, fileSystemId);
lifecycleConfigurationStore.put(regionKey(region, fileSystemId), new ArrayList<>(policies));
}
}
public List<LifecyclePolicy> getLifecycleConfiguration(String region, String fileSystemId) {
getFileSystem(region, fileSystemId);
List<LifecyclePolicy> policies = lifecycleConfigurationStore.get(regionKey(region, fileSystemId)).orElse(null);
return policies == null ? new ArrayList<>() : policies;
}
private String regionKey(String region, String id) {
return region + "::" + id;
}
private String generateAzId(String azName) {
if (azName == null || azName.length() < 2) return azName + "-id";
String region = azName.substring(0, azName.length() - 1);
char letter = azName.charAt(azName.length() - 1);
int num = (letter >= 'a' && letter <= 'z') ? (letter - 'a' + 1) : 1;
String shortCode = region;
String[] parts = region.split("-");
if (parts.length == 3) {
String mid = parts[1].replace("north", "n").replace("south", "s")
.replace("east", "e").replace("west", "w")
.replace("central", "c");
shortCode = parts[0] + mid + parts[2];
}
return shortCode + "-az" + num;
}
}
@@ -0,0 +1,104 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class AccessPointDescription {
private String accessPointArn;
private String accessPointId;
private String clientToken;
private String fileSystemId;
private LifeCycleState lifeCycleState;
private String name;
private String ownerId;
private PosixUser posixUser;
private RootDirectory rootDirectory;
private List<Tag> tags;
public String getAccessPointArn() {
return accessPointArn;
}
public void setAccessPointArn(String accessPointArn) {
this.accessPointArn = accessPointArn;
}
public String getAccessPointId() {
return accessPointId;
}
public void setAccessPointId(String accessPointId) {
this.accessPointId = accessPointId;
}
public String getClientToken() {
return clientToken;
}
public void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
public String getFileSystemId() {
return fileSystemId;
}
public void setFileSystemId(String fileSystemId) {
this.fileSystemId = fileSystemId;
}
public LifeCycleState getLifeCycleState() {
return lifeCycleState;
}
public void setLifeCycleState(LifeCycleState lifeCycleState) {
this.lifeCycleState = lifeCycleState;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOwnerId() {
return ownerId;
}
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
public PosixUser getPosixUser() {
return posixUser;
}
public void setPosixUser(PosixUser posixUser) {
this.posixUser = posixUser;
}
public RootDirectory getRootDirectory() {
return rootDirectory;
}
public void setRootDirectory(RootDirectory rootDirectory) {
this.rootDirectory = rootDirectory;
}
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
}
@@ -0,0 +1,14 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class BackupPolicy {
private String status;
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
}
@@ -0,0 +1,59 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class CreateAccessPointRequest {
private String clientToken;
private String fileSystemId;
private PosixUser posixUser;
private RootDirectory rootDirectory;
private List<Tag> tags;
public String getClientToken() {
return clientToken;
}
public void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
public String getFileSystemId() {
return fileSystemId;
}
public void setFileSystemId(String fileSystemId) {
this.fileSystemId = fileSystemId;
}
public PosixUser getPosixUser() {
return posixUser;
}
public void setPosixUser(PosixUser posixUser) {
this.posixUser = posixUser;
}
public RootDirectory getRootDirectory() {
return rootDirectory;
}
public void setRootDirectory(RootDirectory rootDirectory) {
this.rootDirectory = rootDirectory;
}
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
}
@@ -0,0 +1,94 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class CreateFileSystemRequest {
private String availabilityZoneName;
private Boolean backup;
private String creationToken;
private Boolean encrypted;
private String kmsKeyId;
private PerformanceMode performanceMode;
private Double provisionedThroughputInMibps;
private List<Tag> tags;
private ThroughputMode throughputMode;
public String getAvailabilityZoneName() {
return availabilityZoneName;
}
public void setAvailabilityZoneName(String availabilityZoneName) {
this.availabilityZoneName = availabilityZoneName;
}
public Boolean getBackup() {
return backup;
}
public void setBackup(Boolean backup) {
this.backup = backup;
}
public String getCreationToken() {
return creationToken;
}
public void setCreationToken(String creationToken) {
this.creationToken = creationToken;
}
public Boolean getEncrypted() {
return encrypted;
}
public void setEncrypted(Boolean encrypted) {
this.encrypted = encrypted;
}
public String getKmsKeyId() {
return kmsKeyId;
}
public void setKmsKeyId(String kmsKeyId) {
this.kmsKeyId = kmsKeyId;
}
public PerformanceMode getPerformanceMode() {
return performanceMode;
}
public void setPerformanceMode(PerformanceMode performanceMode) {
this.performanceMode = performanceMode;
}
public Double getProvisionedThroughputInMibps() {
return provisionedThroughputInMibps;
}
public void setProvisionedThroughputInMibps(Double provisionedThroughputInMibps) {
this.provisionedThroughputInMibps = provisionedThroughputInMibps;
}
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
public ThroughputMode getThroughputMode() {
return throughputMode;
}
public void setThroughputMode(ThroughputMode throughputMode) {
this.throughputMode = throughputMode;
}
}
@@ -0,0 +1,68 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class CreateMountTargetRequest {
private String fileSystemId;
private String ipAddress;
private IpAddressType ipAddressType;
private String ipv6Address;
private List<String> securityGroups;
private String subnetId;
public String getFileSystemId() {
return fileSystemId;
}
public void setFileSystemId(String fileSystemId) {
this.fileSystemId = fileSystemId;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public IpAddressType getIpAddressType() {
return ipAddressType;
}
public void setIpAddressType(IpAddressType ipAddressType) {
this.ipAddressType = ipAddressType;
}
public String getIpv6Address() {
return ipv6Address;
}
public void setIpv6Address(String ipv6Address) {
this.ipv6Address = ipv6Address;
}
public List<String> getSecurityGroups() {
return securityGroups;
}
public void setSecurityGroups(List<String> securityGroups) {
this.securityGroups = securityGroups;
}
public String getSubnetId() {
return subnetId;
}
public void setSubnetId(String subnetId) {
this.subnetId = subnetId;
}
}
@@ -0,0 +1,32 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class CreateTagsRequest {
private String fileSystemId;
private List<Tag> tags;
public String getFileSystemId() {
return fileSystemId;
}
public void setFileSystemId(String fileSystemId) {
this.fileSystemId = fileSystemId;
}
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
}
@@ -0,0 +1,39 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class CreationInfo {
private Long ownerGid;
private Long ownerUid;
private String permissions;
public Long getOwnerGid() {
return ownerGid;
}
public void setOwnerGid(Long ownerGid) {
this.ownerGid = ownerGid;
}
public Long getOwnerUid() {
return ownerUid;
}
public void setOwnerUid(Long ownerUid) {
this.ownerUid = ownerUid;
}
public String getPermissions() {
return permissions;
}
public void setPermissions(String permissions) {
this.permissions = permissions;
}
}
@@ -0,0 +1,32 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DeleteTagsRequest {
private String fileSystemId;
private List<String> tagKeys;
public String getFileSystemId() {
return fileSystemId;
}
public void setFileSystemId(String fileSystemId) {
this.fileSystemId = fileSystemId;
}
public List<String> getTagKeys() {
return tagKeys;
}
public void setTagKeys(List<String> tagKeys) {
this.tagKeys = tagKeys;
}
}
@@ -0,0 +1,18 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DescribeAccessPointsResponse {
private List<AccessPointDescription> accessPoints;
private String nextToken;
public List<AccessPointDescription> getAccessPoints() { return accessPoints; }
public void setAccessPoints(List<AccessPointDescription> accessPoints) { this.accessPoints = accessPoints; }
public String getNextToken() { return nextToken; }
public void setNextToken(String nextToken) { this.nextToken = nextToken; }
}
@@ -0,0 +1,17 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DescribeFileSystemPolicyResponse {
private String fileSystemId;
private String policy;
public String getFileSystemId() { return fileSystemId; }
public void setFileSystemId(String fileSystemId) { this.fileSystemId = fileSystemId; }
public String getPolicy() { return policy; }
public void setPolicy(String policy) { this.policy = policy; }
}
@@ -0,0 +1,57 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import jakarta.ws.rs.QueryParam;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DescribeFileSystemsRequest {
@QueryParam("CreationToken")
private String creationToken;
@QueryParam("FileSystemId")
private String fileSystemId;
@QueryParam("Marker")
private String marker;
@QueryParam("MaxItems")
private Integer maxItems;
public String getCreationToken() {
return creationToken;
}
public void setCreationToken(String creationToken) {
this.creationToken = creationToken;
}
public String getFileSystemId() {
return fileSystemId;
}
public void setFileSystemId(String fileSystemId) {
this.fileSystemId = fileSystemId;
}
public String getMarker() {
return marker;
}
public void setMarker(String marker) {
this.marker = marker;
}
public Integer getMaxItems() {
return maxItems;
}
public void setMaxItems(Integer maxItems) {
this.maxItems = maxItems;
}
}
@@ -0,0 +1,40 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DescribeFileSystemsResponse {
private List<FileSystem> fileSystems;
private String marker;
private String nextMarker;
public List<FileSystem> getFileSystems() {
return fileSystems;
}
public void setFileSystems(List<FileSystem> fileSystems) {
this.fileSystems = fileSystems;
}
public String getMarker() {
return marker;
}
public void setMarker(String marker) {
this.marker = marker;
}
public String getNextMarker() {
return nextMarker;
}
public void setNextMarker(String nextMarker) {
this.nextMarker = nextMarker;
}
}
@@ -0,0 +1,21 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DescribeMountTargetSecurityGroupsRequest {
private String mountTargetId;
public String getMountTargetId() {
return mountTargetId;
}
public void setMountTargetId(String mountTargetId) {
this.mountTargetId = mountTargetId;
}
}
@@ -0,0 +1,23 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DescribeMountTargetSecurityGroupsResponse {
private List<String> securityGroups;
public List<String> getSecurityGroups() {
return securityGroups;
}
public void setSecurityGroups(List<String> securityGroups) {
this.securityGroups = securityGroups;
}
}
@@ -0,0 +1,68 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import jakarta.ws.rs.QueryParam;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DescribeMountTargetsRequest {
@QueryParam("AccessPointId")
private String accessPointId;
@QueryParam("FileSystemId")
private String fileSystemId;
@QueryParam("Marker")
private String marker;
@QueryParam("MaxItems")
private Integer maxItems;
@QueryParam("MountTargetId")
private String mountTargetId;
public String getAccessPointId() {
return accessPointId;
}
public void setAccessPointId(String accessPointId) {
this.accessPointId = accessPointId;
}
public String getFileSystemId() {
return fileSystemId;
}
public void setFileSystemId(String fileSystemId) {
this.fileSystemId = fileSystemId;
}
public String getMarker() {
return marker;
}
public void setMarker(String marker) {
this.marker = marker;
}
public Integer getMaxItems() {
return maxItems;
}
public void setMaxItems(Integer maxItems) {
this.maxItems = maxItems;
}
public String getMountTargetId() {
return mountTargetId;
}
public void setMountTargetId(String mountTargetId) {
this.mountTargetId = mountTargetId;
}
}
@@ -0,0 +1,41 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DescribeMountTargetsResponse {
private String marker;
private List<MountTarget> mountTargets;
private String nextMarker;
public String getMarker() {
return marker;
}
public void setMarker(String marker) {
this.marker = marker;
}
public List<MountTarget> getMountTargets() {
return mountTargets;
}
public void setMountTargets(List<MountTarget> mountTargets) {
this.mountTargets = mountTargets;
}
public String getNextMarker() {
return nextMarker;
}
public void setNextMarker(String nextMarker) {
this.nextMarker = nextMarker;
}
}
@@ -0,0 +1,41 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DescribeTagsRequest {
private String fileSystemId;
@jakarta.ws.rs.QueryParam("Marker")
private String marker;
@jakarta.ws.rs.QueryParam("MaxItems")
private Integer maxItems;
public String getFileSystemId() {
return fileSystemId;
}
public void setFileSystemId(String fileSystemId) {
this.fileSystemId = fileSystemId;
}
public String getMarker() {
return marker;
}
public void setMarker(String marker) {
this.marker = marker;
}
public Integer getMaxItems() {
return maxItems;
}
public void setMaxItems(Integer maxItems) {
this.maxItems = maxItems;
}
}
@@ -0,0 +1,41 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class DescribeTagsResponse {
private String marker;
private String nextMarker;
private List<Tag> tags;
public String getMarker() {
return marker;
}
public void setMarker(String marker) {
this.marker = marker;
}
public String getNextMarker() {
return nextMarker;
}
public void setNextMarker(String nextMarker) {
this.nextMarker = nextMarker;
}
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
}
@@ -0,0 +1,178 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class FileSystem {
private String availabilityZoneId;
private String availabilityZoneName;
private Long creationTime;
private String creationToken;
private Boolean encrypted;
private String fileSystemArn;
private String fileSystemId;
private FileSystemProtectionDescription fileSystemProtection;
private String kmsKeyId;
private String lifeCycleState;
private String name;
private Integer numberOfMountTargets;
private String ownerId;
private String performanceMode;
private Double provisionedThroughputInMibps;
private FileSystemSize sizeInBytes;
private List<Tag> tags;
private String throughputMode;
public String getAvailabilityZoneId() {
return availabilityZoneId;
}
public void setAvailabilityZoneId(String availabilityZoneId) {
this.availabilityZoneId = availabilityZoneId;
}
public String getAvailabilityZoneName() {
return availabilityZoneName;
}
public void setAvailabilityZoneName(String availabilityZoneName) {
this.availabilityZoneName = availabilityZoneName;
}
public Long getCreationTime() {
return creationTime;
}
public void setCreationTime(Long creationTime) {
this.creationTime = creationTime;
}
public String getCreationToken() {
return creationToken;
}
public void setCreationToken(String creationToken) {
this.creationToken = creationToken;
}
public Boolean getEncrypted() {
return encrypted;
}
public void setEncrypted(Boolean encrypted) {
this.encrypted = encrypted;
}
public String getFileSystemArn() {
return fileSystemArn;
}
public void setFileSystemArn(String fileSystemArn) {
this.fileSystemArn = fileSystemArn;
}
public String getFileSystemId() {
return fileSystemId;
}
public void setFileSystemId(String fileSystemId) {
this.fileSystemId = fileSystemId;
}
public FileSystemProtectionDescription getFileSystemProtectionDescription() {
return fileSystemProtection;
}
public void setFileSystemProtectionDescription(FileSystemProtectionDescription fileSystemProtection) {
this.fileSystemProtection = fileSystemProtection;
}
public String getKmsKeyId() {
return kmsKeyId;
}
public void setKmsKeyId(String kmsKeyId) {
this.kmsKeyId = kmsKeyId;
}
public String getLifeCycleState() {
return lifeCycleState;
}
public void setLifeCycleState(String lifeCycleState) {
this.lifeCycleState = lifeCycleState;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getNumberOfMountTargets() {
return numberOfMountTargets;
}
public void setNumberOfMountTargets(Integer numberOfMountTargets) {
this.numberOfMountTargets = numberOfMountTargets;
}
public String getOwnerId() {
return ownerId;
}
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
public String getPerformanceMode() {
return performanceMode;
}
public void setPerformanceMode(String performanceMode) {
this.performanceMode = performanceMode;
}
public Double getProvisionedThroughputInMibps() {
return provisionedThroughputInMibps;
}
public void setProvisionedThroughputInMibps(Double provisionedThroughputInMibps) {
this.provisionedThroughputInMibps = provisionedThroughputInMibps;
}
public FileSystemSize getSizeInBytes() {
return sizeInBytes;
}
public void setSizeInBytes(FileSystemSize sizeInBytes) {
this.sizeInBytes = sizeInBytes;
}
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
public String getThroughputMode() {
return throughputMode;
}
public void setThroughputMode(String throughputMode) {
this.throughputMode = throughputMode;
}
}
@@ -0,0 +1,22 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class FileSystemProtectionDescription {
private ReplicationOverwriteProtection replicationOverwriteProtection;
public ReplicationOverwriteProtection getReplicationOverwriteProtection() {
return replicationOverwriteProtection;
}
public void setReplicationOverwriteProtection(
ReplicationOverwriteProtection replicationOverwriteProtection) {
this.replicationOverwriteProtection = replicationOverwriteProtection;
}
}
@@ -0,0 +1,57 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class FileSystemSize {
private Long timestamp;
private Long value;
private Long valueInArchive;
private Long valueInIA;
private Long valueInStandard;
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
public Long getValue() {
return value;
}
public void setValue(Long value) {
this.value = value;
}
public Long getValueInArchive() {
return valueInArchive;
}
public void setValueInArchive(Long valueInArchive) {
this.valueInArchive = valueInArchive;
}
public Long getValueInIA() {
return valueInIA;
}
public void setValueInIA(Long valueInIA) {
this.valueInIA = valueInIA;
}
public Long getValueInStandard() {
return valueInStandard;
}
public void setValueInStandard(Long valueInStandard) {
this.valueInStandard = valueInStandard;
}
}
@@ -0,0 +1,10 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
public enum IpAddressType {
IPV4_ONLY,
IPV6_ONLY,
DUAL_STACK
}
@@ -0,0 +1,13 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
public enum LifeCycleState {
creating,
available,
updating,
deleting,
deleted,
error
}
@@ -0,0 +1,20 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class LifecyclePolicy {
private String transitionToIA;
private String transitionToPrimaryStorageClass;
private String transitionToArchive;
public String getTransitionToIA() { return transitionToIA; }
public void setTransitionToIA(String transitionToIA) { this.transitionToIA = transitionToIA; }
public String getTransitionToPrimaryStorageClass() { return transitionToPrimaryStorageClass; }
public void setTransitionToPrimaryStorageClass(String transitionToPrimaryStorageClass) { this.transitionToPrimaryStorageClass = transitionToPrimaryStorageClass; }
public String getTransitionToArchive() { return transitionToArchive; }
public void setTransitionToArchive(String transitionToArchive) { this.transitionToArchive = transitionToArchive; }
}
@@ -0,0 +1,19 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import java.util.List;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class ListTagsForResourceResponse {
private List<Tag> tags;
private String nextToken;
public List<Tag> getTags() { return tags; }
public void setTags(List<Tag> tags) { this.tags = tags; }
public String getNextToken() { return nextToken; }
public void setNextToken(String nextToken) { this.nextToken = nextToken; }
}
@@ -0,0 +1,32 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class ModifyMountTargetSecurityGroupsRequest {
private String mountTargetId;
private List<String> securityGroups;
public String getMountTargetId() {
return mountTargetId;
}
public void setMountTargetId(String mountTargetId) {
this.mountTargetId = mountTargetId;
}
public List<String> getSecurityGroups() {
return securityGroups;
}
public void setSecurityGroups(List<String> securityGroups) {
this.securityGroups = securityGroups;
}
}
@@ -0,0 +1,131 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class MountTarget {
private String availabilityZoneId;
private String availabilityZoneName;
private String fileSystemId;
private String ipAddress;
private IpAddressType ipAddressType;
private String ipv6Address;
private LifeCycleState lifeCycleState;
private String mountTargetId;
private String networkInterfaceId;
private String ownerId;
private List<String> securityGroups;
private String subnetId;
private String vpcId;
public String getAvailabilityZoneId() {
return availabilityZoneId;
}
public void setAvailabilityZoneId(String availabilityZoneId) {
this.availabilityZoneId = availabilityZoneId;
}
public String getAvailabilityZoneName() {
return availabilityZoneName;
}
public void setAvailabilityZoneName(String availabilityZoneName) {
this.availabilityZoneName = availabilityZoneName;
}
public String getFileSystemId() {
return fileSystemId;
}
public void setFileSystemId(String fileSystemId) {
this.fileSystemId = fileSystemId;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public IpAddressType getIpAddressType() {
return ipAddressType;
}
public void setIpAddressType(IpAddressType ipAddressType) {
this.ipAddressType = ipAddressType;
}
public String getIpv6Address() {
return ipv6Address;
}
public void setIpv6Address(String ipv6Address) {
this.ipv6Address = ipv6Address;
}
public LifeCycleState getLifeCycleState() {
return lifeCycleState;
}
public void setLifeCycleState(LifeCycleState lifeCycleState) {
this.lifeCycleState = lifeCycleState;
}
public String getMountTargetId() {
return mountTargetId;
}
public void setMountTargetId(String mountTargetId) {
this.mountTargetId = mountTargetId;
}
public String getNetworkInterfaceId() {
return networkInterfaceId;
}
public void setNetworkInterfaceId(String networkInterfaceId) {
this.networkInterfaceId = networkInterfaceId;
}
public String getOwnerId() {
return ownerId;
}
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
public List<String> getSecurityGroups() {
return securityGroups;
}
public void setSecurityGroups(List<String> securityGroups) {
this.securityGroups = securityGroups;
}
public String getSubnetId() {
return subnetId;
}
public void setSubnetId(String subnetId) {
this.subnetId = subnetId;
}
public String getVpcId() {
return vpcId;
}
public void setVpcId(String vpcId) {
this.vpcId = vpcId;
}
}
@@ -0,0 +1,9 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
public enum PerformanceMode {
generalPurpose,
maxIO
}
@@ -0,0 +1,41 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class PosixUser {
private Long gid;
private List<Long> secondaryGids;
private Long uid;
public Long getGid() {
return gid;
}
public void setGid(Long gid) {
this.gid = gid;
}
public List<Long> getSecondaryGids() {
return secondaryGids;
}
public void setSecondaryGids(List<Long> secondaryGids) {
this.secondaryGids = secondaryGids;
}
public Long getUid() {
return uid;
}
public void setUid(Long uid) {
this.uid = uid;
}
}
@@ -0,0 +1,17 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class PutBackupPolicyRequest {
private String fileSystemId;
private BackupPolicy backupPolicy;
public String getFileSystemId() { return fileSystemId; }
public void setFileSystemId(String fileSystemId) { this.fileSystemId = fileSystemId; }
public BackupPolicy getBackupPolicy() { return backupPolicy; }
public void setBackupPolicy(BackupPolicy backupPolicy) { this.backupPolicy = backupPolicy; }
}
@@ -0,0 +1,14 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class PutBackupPolicyResponse {
private BackupPolicy backupPolicy;
public BackupPolicy getBackupPolicy() { return backupPolicy; }
public void setBackupPolicy(BackupPolicy backupPolicy) { this.backupPolicy = backupPolicy; }
}
@@ -0,0 +1,20 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class PutFileSystemPolicyRequest {
private String fileSystemId;
private String policy;
private Boolean bypassPolicyLockoutSafetyCheck;
public String getFileSystemId() { return fileSystemId; }
public void setFileSystemId(String fileSystemId) { this.fileSystemId = fileSystemId; }
public String getPolicy() { return policy; }
public void setPolicy(String policy) { this.policy = policy; }
public Boolean getBypassPolicyLockoutSafetyCheck() { return bypassPolicyLockoutSafetyCheck; }
public void setBypassPolicyLockoutSafetyCheck(Boolean bypassPolicyLockoutSafetyCheck) { this.bypassPolicyLockoutSafetyCheck = bypassPolicyLockoutSafetyCheck; }
}
@@ -0,0 +1,17 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class PutFileSystemPolicyResponse {
private String fileSystemId;
private String policy;
public String getFileSystemId() { return fileSystemId; }
public void setFileSystemId(String fileSystemId) { this.fileSystemId = fileSystemId; }
public String getPolicy() { return policy; }
public void setPolicy(String policy) { this.policy = policy; }
}
@@ -0,0 +1,18 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class PutLifecycleConfigurationRequest {
private String fileSystemId;
private List<LifecyclePolicy> lifecyclePolicies;
public String getFileSystemId() { return fileSystemId; }
public void setFileSystemId(String fileSystemId) { this.fileSystemId = fileSystemId; }
public List<LifecyclePolicy> getLifecyclePolicies() { return lifecyclePolicies; }
public void setLifecyclePolicies(List<LifecyclePolicy> lifecyclePolicies) { this.lifecyclePolicies = lifecyclePolicies; }
}
@@ -0,0 +1,15 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class PutLifecycleConfigurationResponse {
private List<LifecyclePolicy> lifecyclePolicies;
public List<LifecyclePolicy> getLifecyclePolicies() { return lifecyclePolicies; }
public void setLifecyclePolicies(List<LifecyclePolicy> lifecyclePolicies) { this.lifecyclePolicies = lifecyclePolicies; }
}
@@ -0,0 +1,10 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
public enum ReplicationOverwriteProtection {
ENABLED,
DISABLED,
REPLICATING
}
@@ -0,0 +1,30 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class RootDirectory {
private CreationInfo creationInfo;
private String path;
public CreationInfo getCreationInfo() {
return creationInfo;
}
public void setCreationInfo(CreationInfo creationInfo) {
this.creationInfo = creationInfo;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
@@ -0,0 +1,44 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class Tag {
private String key;
private String value;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tag tag = (Tag) o;
return java.util.Objects.equals(key, tag.key) &&
java.util.Objects.equals(value, tag.value);
}
@Override
public int hashCode() {
return java.util.Objects.hash(key, value);
}
}
@@ -0,0 +1,19 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import java.util.List;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class TagResourceRequest {
private String resourceId;
private List<Tag> tags;
public String getResourceId() { return resourceId; }
public void setResourceId(String resourceId) { this.resourceId = resourceId; }
public List<Tag> getTags() { return tags; }
public void setTags(List<Tag> tags) { this.tags = tags; }
}
@@ -0,0 +1,10 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
public enum ThroughputMode {
bursting,
provisioned,
elastic
}
@@ -0,0 +1,34 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class UntagResourceRequest {
private String resourceId;
@jakarta.ws.rs.QueryParam("tagKeys")
private List<String> tagKeys;
public String getResourceId() {
return resourceId;
}
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
public List<String> getTagKeys() {
return tagKeys;
}
public void setTagKeys(List<String> tagKeys) {
this.tagKeys = tagKeys;
}
}
@@ -0,0 +1,30 @@
package io.github.hectorvent.floci.services.efs.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
@RegisterForReflection
public class UpdateFileSystemRequest {
private Double provisionedThroughputInMibps;
private ThroughputMode throughputMode;
public Double getProvisionedThroughputInMibps() {
return provisionedThroughputInMibps;
}
public void setProvisionedThroughputInMibps(Double provisionedThroughputInMibps) {
this.provisionedThroughputInMibps = provisionedThroughputInMibps;
}
public ThroughputMode getThroughputMode() {
return throughputMode;
}
public void setThroughputMode(ThroughputMode throughputMode) {
this.throughputMode = throughputMode;
}
}
+2
View File
@@ -530,6 +530,8 @@ floci:
enabled: true
cloudhsmv2:
enabled: true
efs:
enabled: true
organizations:
enabled: true
rum:
@@ -0,0 +1,233 @@
package io.github.hectorvent.floci.services.efs;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestMethodOrder;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
@QuarkusTest
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class EfsIntegrationTest {
private String fileSystemId;
private String mountTargetId;
private String accessPointId;
@BeforeAll
static void configureRestAssured() {
RestAssuredJsonUtils.configureAwsContentTypes();
}
@Test
@Order(1)
void createFileSystem() {
fileSystemId = given()
.contentType("application/json")
.body("""
{
"CreationToken": "my-token",
"PerformanceMode": "generalPurpose",
"Encrypted": true,
"Tags": [{"Key": "Name", "Value": "MyFS"}]
}
""")
.when()
.post("/2015-02-01/file-systems")
.then()
.statusCode(201)
.body("FileSystemId", startsWith("fs-"))
.body("Encrypted", equalTo(true))
.body("NumberOfMountTargets", equalTo(0))
.body("Tags[0].Value", equalTo("MyFS"))
.extract().jsonPath().getString("FileSystemId");
}
@Test
@Order(2)
void describeFileSystemsByFileSystemId() {
given()
.queryParam("FileSystemId", fileSystemId)
.when()
.get("/2015-02-01/file-systems")
.then()
.statusCode(200)
.body("FileSystems.size()", equalTo(1))
.body("FileSystems[0].FileSystemId", equalTo(fileSystemId));
}
@Test
@Order(3)
void updateFileSystem() {
given()
.contentType("application/json")
.body("""
{
"ThroughputMode": "provisioned",
"ProvisionedThroughputInMibps": 50.0
}
""")
.when()
.put("/2015-02-01/file-systems/" + fileSystemId)
.then()
.statusCode(202)
.body("ProvisionedThroughputInMibps", equalTo(50.0f));
}
@Test
@Order(4)
void createMountTarget() {
mountTargetId = given()
.contentType("application/json")
.body("""
{
"FileSystemId": "%s",
"SubnetId": "subnet-12345",
"SecurityGroups": ["sg-11111"]
}
""".formatted(fileSystemId))
.when()
.post("/2015-02-01/mount-targets")
.then()
.statusCode(200)
.body("MountTargetId", startsWith("fsmt-"))
.body("FileSystemId", equalTo(fileSystemId))
.body("SubnetId", equalTo("subnet-12345"))
.extract().jsonPath().getString("MountTargetId");
}
@Test
@Order(5)
void describeMountTargets() {
given()
.contentType("application/json")
.queryParam("FileSystemId", fileSystemId)
.when()
.get("/2015-02-01/mount-targets")
.then()
.statusCode(200)
.body("MountTargets.MountTargetId", hasItem(mountTargetId));
}
@Test
@Order(6)
void modifyMountTargetSecurityGroups() {
given()
.contentType("application/json")
.body("""
{
"SecurityGroups": ["sg-22222"]
}
""")
.when()
.put("/2015-02-01/mount-targets/" + mountTargetId + "/security-groups")
.then()
.statusCode(204);
given()
.contentType("application/json")
.when()
.get("/2015-02-01/mount-targets/" + mountTargetId + "/security-groups")
.then()
.statusCode(200)
.body("SecurityGroups", hasItem("sg-22222"));
}
@Test
@Order(7)
void createAccessPoint() {
accessPointId = given()
.contentType("application/json")
.body("""
{
"ClientToken": "ap-token",
"FileSystemId": "%s"
}
""".formatted(fileSystemId))
.when()
.post("/2015-02-01/access-points")
.then()
.statusCode(200)
.body("AccessPointId", startsWith("fsap-"))
.body("FileSystemId", equalTo(fileSystemId))
.extract().jsonPath().getString("AccessPointId");
}
@Test
@Order(8)
void describeAccessPoints() {
given()
.contentType("application/json")
.queryParam("FileSystemId", fileSystemId)
.when()
.get("/2015-02-01/access-points")
.then()
.statusCode(200)
.body("AccessPoints.AccessPointId", hasItem(accessPointId));
}
@Test
@Order(9)
void manageFileSystemPolicy() {
given()
.contentType("application/json")
.body("""
{
"Policy": "{\\"Statement\\": []}"
}
""")
.when()
.put("/2015-02-01/file-systems/" + fileSystemId + "/policy")
.then()
.statusCode(200)
.body("Policy", equalTo("{\"Statement\": []}"));
given()
.contentType("application/json")
.when()
.get("/2015-02-01/file-systems/" + fileSystemId + "/policy")
.then()
.statusCode(200)
.body("Policy", equalTo("{\"Statement\": []}"));
}
@Test
@Order(10)
void deleteResources() {
given()
.contentType("application/json")
.when()
.delete("/2015-02-01/access-points/" + accessPointId)
.then()
.statusCode(204);
given()
.contentType("application/json")
.when()
.delete("/2015-02-01/mount-targets/" + mountTargetId)
.then()
.statusCode(204);
given()
.contentType("application/json")
.when()
.delete("/2015-02-01/file-systems/" + fileSystemId)
.then()
.statusCode(204);
given()
.contentType("application/json")
.when()
.get("/2015-02-01/file-systems")
.then()
.statusCode(200)
.body("FileSystems.FileSystemId", not(hasItem(fileSystemId)));
}
}
+2
View File
@@ -324,6 +324,8 @@ floci:
enabled: true
cloudhsmv2:
enabled: true
efs:
enabled: true
organizations:
enabled: true
rum:
+4
View File
@@ -38,6 +38,10 @@ services:
doc: docs/services/docdb.md
sources:
- { path: src/main/java/io/github/hectorvent/floci/services/docdb/DocDbQueryHandler.java, mode: switch }
- service: efs
doc: docs/services/efs.md
sources:
- { path: src/main/java/io/github/hectorvent/floci/services/efs/EfsController.java, mode: rest }
- service: organizations
doc: docs/services/organizations.md
sources: