diff --git a/docs/services/index.md b/docs/services/index.md index d77bf8b149..e1efde9e52 100644 --- a/docs/services/index.md +++ b/docs/services/index.md @@ -52,6 +52,7 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac | [MWAA](mwaa.md) | `/` REST paths for environments + CLI/web proxy | REST JSON | 10 | | [Athena](athena.md) | `POST /` + `X-Amz-Target: AmazonAthena.*` | JSON 1.1 | 4 | | [Glue](glue.md) | `POST /` + `X-Amz-Target: AWSGlue.*` | JSON 1.1 | 38 | +| [Lake Formation](lakeformation.md) | `POST /` | REST JSON | 16 | | [Neptune](neptune.md) | `POST /` with `Action=` param + Gremlin TCP proxy | Query + WebSocket | 8 | | [DocumentDB](docdb.md) | `POST /` with `Action=` param + MongoDB container | Query + MongoDB wire | 8 | | [EMR](emr.md) | `POST /` + `X-Amz-Target: ElasticMapReduce.*` | JSON 1.1 | 24 | diff --git a/docs/services/lakeformation.md b/docs/services/lakeformation.md new file mode 100644 index 0000000000..df35db646e --- /dev/null +++ b/docs/services/lakeformation.md @@ -0,0 +1,42 @@ +# Lake Formation + +The `lakeformation` service allows you to manage data lake settings, resources, permissions, and LF-Tags, serving as the permission layer over the Glue Data Catalog. + +## Configuration + +| Key | Default | Description | +|---|---|---| +| `floci.services.lakeformation.enabled` | `true` | Enable or disable the Lake Formation service. | +| `floci.storage.services.lakeformation.mode` | *inherited* | Storage backend for Lake Formation settings and permissions: `memory`, `persistent`. | +| `floci.storage.services.lakeformation.flush-interval-ms` | `5000` | How often to flush state to disk when using persistent storage. | + +## Supported Operations + +### Data Lake Settings +* `PutDataLakeSettings` +* `GetDataLakeSettings` + +### Resource Registration +* `RegisterResource` +* `DeregisterResource` +* `ListResources` +* `DescribeResource` + +### Permissions +* `GrantPermissions` +* `RevokePermissions` +* `ListPermissions` + +### LF-Tags +* `CreateLFTag` +* `GetLFTag` +* `UpdateLFTag` +* `DeleteLFTag` +* `ListLFTags` +* `AddLFTagsToResource` +* `RemoveLFTagsFromResource` + +## Implementation Details +Floci currently supports basic CRUD operations for Lake Formation resources, permissions, and tags. This state is strictly persisted without deep integration into other data-plane emulators. + +Permissions retrieval via `ListPermissions` currently lists all explicitly granted permissions to satisfy Terraform state expectations without strict caller permission filtering. diff --git a/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java b/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java index 89720aeeb2..81f93b65b7 100644 --- a/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java +++ b/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java @@ -286,6 +286,7 @@ public interface EmulatorConfig { RumStorageConfig rum(); GuardDutyStorageConfig guardduty(); EmrServerlessStorageConfig emrserverless(); + LakeFormationStorageConfig lakeformation(); EfsStorageConfig efs(); } @@ -537,13 +538,19 @@ public interface EmulatorConfig { long flushIntervalMs(); } + interface LakeFormationStorageConfig { + Optional mode(); + + @WithDefault("5000") + long flushIntervalMs(); + } interface EfsStorageConfig { Optional mode(); @WithDefault("5000") long flushIntervalMs(); } - + interface CodeDeployStorageConfig { Optional mode(); @@ -655,6 +662,7 @@ public interface EmulatorConfig { RumServiceConfig rum(); GuardDutyServiceConfig guardduty(); EmrServerlessServiceConfig emrserverless(); + LakeFormationServiceConfig lakeformation(); EfsServiceConfig efs(); } @@ -699,6 +707,11 @@ public interface EmulatorConfig { boolean enabled(); } + interface LakeFormationServiceConfig { + @WithDefault("true") + boolean enabled(); + } + interface EfsServiceConfig { @WithDefault("true") boolean enabled(); diff --git a/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java b/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java index 684f253d29..2b6340e794 100644 --- a/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java +++ b/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java @@ -502,6 +502,12 @@ public class ResolvedServiceCatalog { config.storage().services().guardduty().flushIntervalMs(), null, ServiceProtocol.REST_JSON, protocols(ServiceProtocol.REST_JSON), Set.of(), Set.of("guardduty"), Set.of(), Set.of(GuardDutyController.class)), + descriptor("lakeformation", "lakeformation", config.services().lakeformation().enabled(), true, + "lakeformation", + storageMode(config.storage().services().lakeformation().mode(), config.storage().mode()), + config.storage().services().lakeformation().flushIntervalMs(), null, ServiceProtocol.REST_JSON, + protocols(ServiceProtocol.REST_JSON), + Set.of(), Set.of("lakeformation"), Set.of(), Set.of(io.github.hectorvent.floci.services.lakeformation.LakeFormationController.class)), descriptor("efs", "efs", config.services().efs().enabled(), true, "efs", storageMode(config.storage().services().efs().mode(), config.storage().mode()), diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationController.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationController.java new file mode 100644 index 0000000000..2ac46c979d --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationController.java @@ -0,0 +1,158 @@ +package io.github.hectorvent.floci.services.lakeformation; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.github.hectorvent.floci.core.common.AwsException; +import io.github.hectorvent.floci.core.common.RegionResolver; +import io.github.hectorvent.floci.services.lakeformation.model.*; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +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("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class LakeFormationController { + + private final LakeFormationService service; + private final ObjectMapper mapper; + private final RegionResolver regionResolver; + + @Inject + public LakeFormationController(LakeFormationService service, ObjectMapper mapper, RegionResolver regionResolver) { + this.service = service; + this.mapper = mapper; + this.regionResolver = regionResolver; + } + + private JsonNode parse(String body) { + if (body == null || body.isBlank()) { + return mapper.createObjectNode(); + } + try { + JsonNode request = mapper.readTree(body); + if (request == null || !request.isObject()) { + throw new AwsException("SerializationException", "Request body must be a JSON object.", 400); + } + return request; + } catch (AwsException e) { + throw e; + } catch (Exception e) { + throw new AwsException("SerializationException", "Request body is not valid JSON.", 400); + } + } + + private Response handleResponse(Object responseModel) { + if (responseModel == null) { + return Response.ok() + .header("x-amzn-RequestId", "floci-" + System.currentTimeMillis()) + .build(); + } + return Response.ok() + .header("x-amzn-RequestId", "floci-" + System.currentTimeMillis()) + .entity(responseModel) + .build(); + } + + @POST + @Path("/PutDataLakeSettings") + public Response putDataLakeSettings(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.putDataLakeSettings(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), PutDataLakeSettingsRequest.class))); + } + + @POST + @Path("/GetDataLakeSettings") + public Response getDataLakeSettings(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.getDataLakeSettings(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), GetDataLakeSettingsRequest.class))); + } + + @POST + @Path("/RegisterResource") + public Response registerResource(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.registerResource(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), RegisterResourceRequest.class))); + } + + @POST + @Path("/DeregisterResource") + public Response deregisterResource(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.deregisterResource(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), DeregisterResourceRequest.class))); + } + + @POST + @Path("/ListResources") + public Response listResources(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.listResources(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), ListResourcesRequest.class))); + } + + @POST + @Path("/DescribeResource") + public Response describeResource(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.describeResource(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), DescribeResourceRequest.class))); + } + + @POST + @Path("/GrantPermissions") + public Response grantPermissions(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.grantPermissions(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), GrantPermissionsRequest.class))); + } + + @POST + @Path("/RevokePermissions") + public Response revokePermissions(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.revokePermissions(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), RevokePermissionsRequest.class))); + } + + @POST + @Path("/ListPermissions") + public Response listPermissions(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.listPermissions(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), ListPermissionsRequest.class))); + } + + @POST + @Path("/CreateLFTag") + public Response createLFTag(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.createLFTag(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), CreateLFTagRequest.class))); + } + + @POST + @Path("/GetLFTag") + public Response getLFTag(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.getLFTag(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), GetLFTagRequest.class))); + } + + @POST + @Path("/UpdateLFTag") + public Response updateLFTag(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.updateLFTag(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), UpdateLFTagRequest.class))); + } + + @POST + @Path("/DeleteLFTag") + public Response deleteLFTag(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.deleteLFTag(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), DeleteLFTagRequest.class))); + } + + @POST + @Path("/ListLFTags") + public Response listLFTags(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.listLFTags(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), ListLFTagsRequest.class))); + } + + @POST + @Path("/AddLFTagsToResource") + public Response addLFTagsToResource(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.addLFTagsToResource(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), AddLFTagsToResourceRequest.class))); + } + + @POST + @Path("/RemoveLFTagsFromResource") + public Response removeLFTagsFromResource(@Context HttpHeaders headers, String body) throws Exception { + return handleResponse(service.removeLFTagsFromResource(regionResolver.resolveRegion(headers), mapper.treeToValue(parse(body), RemoveLFTagsFromResourceRequest.class))); + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationService.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationService.java new file mode 100644 index 0000000000..bf28887938 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationService.java @@ -0,0 +1,238 @@ +package io.github.hectorvent.floci.services.lakeformation; + +import io.github.hectorvent.floci.core.common.AwsException; +import io.github.hectorvent.floci.core.common.RegionResolver; +import io.github.hectorvent.floci.services.lakeformation.model.*; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +import java.util.List; + +@ApplicationScoped +public class LakeFormationService { + + private final LakeFormationStorage storage; + private final RegionResolver regionResolver; + + @Inject + public LakeFormationService(LakeFormationStorage storage, RegionResolver regionResolver) { + this.storage = storage; + this.regionResolver = regionResolver; + } + + public PutDataLakeSettingsResponse putDataLakeSettings(String region, PutDataLakeSettingsRequest request) { + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + storage.putDataLakeSettings(region, catalogId, request.getDataLakeSettings()); + return new PutDataLakeSettingsResponse(); + } + + public GetDataLakeSettingsResponse getDataLakeSettings(String region, GetDataLakeSettingsRequest request) { + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + DataLakeSettings settings = storage.getDataLakeSettings(region, catalogId).orElseGet(DataLakeSettings::new); + + GetDataLakeSettingsResponse response = new GetDataLakeSettingsResponse(); + response.setDataLakeSettings(settings); + return response; + } + + public RegisterResourceResponse registerResource(String region, RegisterResourceRequest request) { + if (request.getResourceArn() == null) { + throw new AwsException("InvalidInputException", "ResourceArn is required", 400); + } + if (!request.getResourceArn().startsWith("arn:")) { + throw new AwsException("InvalidInputException", "ResourceArn must be a valid ARN", 400); + } + if (storage.describeResource(region, request.getResourceArn()).isPresent()) { + throw new AwsException("AlreadyExistsException", "Resource is already registered", 400); + } + storage.registerResource( + region, + request.getResourceArn(), + request.getRoleArn(), + Boolean.TRUE.equals(request.getUseServiceLinkedRole()), + request.getWithFederation() + ); + return new RegisterResourceResponse(); + } + + public DeregisterResourceResponse deregisterResource(String region, DeregisterResourceRequest request) { + if (request.getResourceArn() == null) { + throw new AwsException("InvalidInputException", "ResourceArn is required", 400); + } + if (storage.describeResource(region, request.getResourceArn()).isEmpty()) { + throw new AwsException("EntityNotFoundException", "Resource not found", 400); + } + storage.deregisterResource(region, request.getResourceArn()); + return new DeregisterResourceResponse(); + } + + public ListResourcesResponse listResources(String region, ListResourcesRequest request) { + List resources = storage.listResources( + region, + request.getFilterConditionList(), + request.getMaxResults(), + request.getNextToken() + ); + ListResourcesResponse response = new ListResourcesResponse(); + response.setResourceInfoList(resources); + return response; + } + + public DescribeResourceResponse describeResource(String region, DescribeResourceRequest request) { + ResourceInfo info = storage.describeResource(region, request.getResourceArn()) + .orElseThrow(() -> new AwsException("EntityNotFoundException", "Resource not found", 400)); + + DescribeResourceResponse response = new DescribeResourceResponse(); + response.setResourceInfo(info); + return response; + } + + public GrantPermissionsResponse grantPermissions(String region, GrantPermissionsRequest request) { + if (request.getPrincipal() == null) { + throw new AwsException("InvalidInputException", "Principal is required", 400); + } + if (request.getResource() == null) { + throw new AwsException("InvalidInputException", "Resource is required", 400); + } + if (request.getPermissions() == null || request.getPermissions().isEmpty()) { + throw new AwsException("InvalidInputException", "Permissions is required", 400); + } + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + + if (request.getPermissionsWithGrantOption() != null) { + java.util.List perms = request.getPermissions() != null ? request.getPermissions() : java.util.List.of(); + for (String grantOption : request.getPermissionsWithGrantOption()) { + if (!perms.contains(grantOption)) { + throw new AwsException("InvalidInputException", "PermissionsWithGrantOption must be a subset of Permissions", 400); + } + } + } + + PrincipalResourcePermissions p = new PrincipalResourcePermissions(); + p.setPrincipal(request.getPrincipal()); + p.setResource(request.getResource()); + p.setPermissions(request.getPermissions()); + p.setPermissionsWithGrantOption(request.getPermissionsWithGrantOption()); + + storage.grantPermissions(region, catalogId, p); + return new GrantPermissionsResponse(); + } + + public RevokePermissionsResponse revokePermissions(String region, RevokePermissionsRequest request) { + if (request.getPrincipal() == null) { + throw new AwsException("InvalidInputException", "Principal is required", 400); + } + if (request.getResource() == null) { + throw new AwsException("InvalidInputException", "Resource is required", 400); + } + if (request.getPermissions() == null || request.getPermissions().isEmpty()) { + throw new AwsException("InvalidInputException", "Permissions is required", 400); + } + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + + PrincipalResourcePermissions p = new PrincipalResourcePermissions(); + p.setPrincipal(request.getPrincipal()); + p.setResource(request.getResource()); + p.setPermissions(request.getPermissions()); + p.setPermissionsWithGrantOption(request.getPermissionsWithGrantOption()); + + storage.revokePermissions(region, catalogId, p); + return new RevokePermissionsResponse(); + } + + public ListPermissionsResponse listPermissions(String region, ListPermissionsRequest request) { + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + + List permissions = storage.listPermissions( + region, + catalogId, + request.getPrincipal(), + request.getResource(), + request.getResourceType(), + Boolean.TRUE.equals(request.getIncludeRelated()), + request.getMaxResults(), + request.getNextToken() + ); + + ListPermissionsResponse response = new ListPermissionsResponse(); + response.setPrincipalResourcePermissions(permissions); + return response; + } + + public CreateLFTagResponse createLFTag(String region, CreateLFTagRequest request) { + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + if (request.getTagKey() == null) { + throw new AwsException("InvalidInputException", "TagKey is required", 400); + } + if (storage.getLFTag(region, catalogId, request.getTagKey()).isPresent()) { + throw new AwsException("AlreadyExistsException", "Tag already exists", 400); + } + storage.createLFTag(region, catalogId, request.getTagKey(), request.getTagValues()); + return new CreateLFTagResponse(); + } + + public GetLFTagResponse getLFTag(String region, GetLFTagRequest request) { + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + LFTag tag = storage.getLFTag(region, catalogId, request.getTagKey()) + .orElseThrow(() -> new AwsException("EntityNotFoundException", "LF-Tag not found", 400)); + + GetLFTagResponse response = new GetLFTagResponse(); + response.setCatalogId(catalogId); + response.setTagKey(tag.getTagKey()); + response.setTagValues(tag.getTagValues()); + return response; + } + + public UpdateLFTagResponse updateLFTag(String region, UpdateLFTagRequest request) { + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + // check exists + storage.getLFTag(region, catalogId, request.getTagKey()) + .orElseThrow(() -> new AwsException("EntityNotFoundException", "LF-Tag not found", 400)); + + storage.updateLFTag(region, catalogId, request.getTagKey(), request.getTagValuesToAdd(), request.getTagValuesToDelete()); + return new UpdateLFTagResponse(); + } + + public DeleteLFTagResponse deleteLFTag(String region, DeleteLFTagRequest request) { + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + storage.getLFTag(region, catalogId, request.getTagKey()) + .orElseThrow(() -> new AwsException("EntityNotFoundException", "LF-Tag not found", 400)); + + storage.deleteLFTag(region, catalogId, request.getTagKey()); + return new DeleteLFTagResponse(); + } + + public ListLFTagsResponse listLFTags(String region, ListLFTagsRequest request) { + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + List tags = storage.listLFTags(region, catalogId, request.getResourceShareType(), request.getMaxResults(), request.getNextToken()); + + ListLFTagsResponse response = new ListLFTagsResponse(); + response.setLfTags(tags); + return response; + } + + public AddLFTagsToResourceResponse addLFTagsToResource(String region, AddLFTagsToResourceRequest request) { + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + if (request.getResource() == null) { + throw new AwsException("InvalidInputException", "Resource is required", 400); + } + storage.addLFTagsToResource(region, catalogId, request.getResource(), request.getLfTags()); + + AddLFTagsToResourceResponse response = new AddLFTagsToResourceResponse(); + response.setFailures(List.of()); // Success for all + return response; + } + + public RemoveLFTagsFromResourceResponse removeLFTagsFromResource(String region, RemoveLFTagsFromResourceRequest request) { + String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId(); + if (request.getResource() == null) { + throw new AwsException("InvalidInputException", "Resource is required", 400); + } + storage.removeLFTagsFromResource(region, catalogId, request.getResource(), request.getLfTags()); + + RemoveLFTagsFromResourceResponse response = new RemoveLFTagsFromResourceResponse(); + response.setFailures(List.of()); // Success for all + return response; + } + +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationStorage.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationStorage.java new file mode 100644 index 0000000000..b42d88ad44 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationStorage.java @@ -0,0 +1,31 @@ +package io.github.hectorvent.floci.services.lakeformation; + +import io.github.hectorvent.floci.services.lakeformation.model.*; +import java.util.List; +import java.util.Optional; + +public interface LakeFormationStorage { + + void putDataLakeSettings(String region, String catalogId, DataLakeSettings settings); + Optional getDataLakeSettings(String region, String catalogId); + + void registerResource(String region, String resourceArn, String roleArn, boolean useServiceLinkedRole, Boolean withFederation); + void deregisterResource(String region, String resourceArn); + List listResources(String region, List filterConditions, Integer maxResults, String nextToken); + Optional describeResource(String region, String resourceArn); + + void grantPermissions(String region, String catalogId, PrincipalResourcePermissions permissions); + void revokePermissions(String region, String catalogId, PrincipalResourcePermissions permissions); + List listPermissions(String region, String catalogId, DataLakePrincipal principal, + Resource resource, String resourceType, + boolean includeRelated, Integer maxResults, String nextToken); + + void createLFTag(String region, String catalogId, String tagKey, List tagValues); + Optional getLFTag(String region, String catalogId, String tagKey); + void updateLFTag(String region, String catalogId, String tagKey, List tagValuesToAdd, List tagValuesToDelete); + void deleteLFTag(String region, String catalogId, String tagKey); + List listLFTags(String region, String catalogId, String resourceShareType, Integer maxResults, String nextToken); + + void addLFTagsToResource(String region, String catalogId, Resource resource, List lfTags); + void removeLFTagsFromResource(String region, String catalogId, Resource resource, List lfTags); +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/MemoryLakeFormationStorage.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/MemoryLakeFormationStorage.java new file mode 100644 index 0000000000..a633927ffc --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/MemoryLakeFormationStorage.java @@ -0,0 +1,335 @@ +package io.github.hectorvent.floci.services.lakeformation; + +import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend; +import io.github.hectorvent.floci.core.storage.StorageFactory; +import io.github.hectorvent.floci.services.lakeformation.model.*; +import com.fasterxml.jackson.core.type.TypeReference; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +@ApplicationScoped +public class MemoryLakeFormationStorage implements LakeFormationStorage { + + private final AccountAwareStorageBackend settingsStorage; + private final AccountAwareStorageBackend resourcesStorage; + private final AccountAwareStorageBackend permissionsStorage; + private final AccountAwareStorageBackend lfTagsStorage; + private final AccountAwareStorageBackend> resourceTagsStorage; + + @Inject + public MemoryLakeFormationStorage(StorageFactory storageFactory) { + this.settingsStorage = storageFactory.create("lakeformation", "lakeformation-settings.json", new TypeReference<>() {}); + this.resourcesStorage = storageFactory.create("lakeformation", "lakeformation-resources.json", new TypeReference<>() {}); + this.permissionsStorage = storageFactory.create("lakeformation", "lakeformation-permissions.json", new TypeReference<>() {}); + this.lfTagsStorage = storageFactory.create("lakeformation", "lakeformation-tags.json", new TypeReference<>() {}); + this.resourceTagsStorage = storageFactory.create("lakeformation", "lakeformation-resource-tags.json", new TypeReference<>() {}); + } + + @Override + public void putDataLakeSettings(String region, String catalogId, DataLakeSettings settings) { + settingsStorage.put(region + ":" + catalogId, settings); + } + + @Override + public Optional getDataLakeSettings(String region, String catalogId) { + return settingsStorage.get(region + ":" + catalogId); + } + + @Override + public void registerResource(String region, String resourceArn, String roleArn, boolean useServiceLinkedRole, Boolean withFederation) { + ResourceInfo info = new ResourceInfo(); + info.setResourceArn(resourceArn); + info.setRoleArn(roleArn); + info.setWithFederation(withFederation); + // Use arn as key for storage + resourcesStorage.put(region + ":" + resourceArn, info); + } + + @Override + public void deregisterResource(String region, String resourceArn) { + resourcesStorage.delete(region + ":" + resourceArn); + } + + @Override + public List listResources(String region, List filterConditions, Integer maxResults, String nextToken) { + // Deliberate omission: MaxResults and NextToken are ignored. All results fit on a single page. + return resourcesStorage.scan(k -> k.startsWith(region + ":")).stream() + .filter(r -> { + if (filterConditions != null) { + for (FilterCondition filterCondition : filterConditions) { + if ("RESOURCE_ARN".equals(filterCondition.getField())) { + String arn = r.getResourceArn(); + List values = filterCondition.getStringValueList(); + if (values != null && !values.isEmpty()) { + String op = filterCondition.getComparisonOperator(); + if ("EQ".equals(op)) { + if (!values.contains(arn)) return false; + } else if ("NE".equals(op)) { + if (values.contains(arn)) return false; + } else if ("BEGINS_WITH".equals(op)) { + if (values.stream().noneMatch(arn::startsWith)) return false; + } else { + throw new io.github.hectorvent.floci.core.common.AwsException("InvalidInputException", "Unsupported ComparisonOperator: " + op, 400); + } + } + } + } + } + return true; + }) + .collect(Collectors.toList()); + } + + @Override + public Optional describeResource(String region, String resourceArn) { + return resourcesStorage.get(region + ":" + resourceArn); + } + + @Override + public void grantPermissions(String region, String catalogId, PrincipalResourcePermissions permissions) { + String key = region + ":" + buildPermissionsKey(catalogId, permissions); + PrincipalResourcePermissions existing = permissionsStorage.get(key).orElse(null); + if (existing != null) { + if (permissions.getPermissions() != null) { + List current = new ArrayList<>(existing.getPermissions() != null ? existing.getPermissions() : List.of()); + for (String p : permissions.getPermissions()) { + if (!current.contains(p)) { + current.add(p); + } + } + existing.setPermissions(current); + } + if (permissions.getPermissionsWithGrantOption() != null) { + List current = new ArrayList<>(existing.getPermissionsWithGrantOption() != null ? existing.getPermissionsWithGrantOption() : List.of()); + for (String p : permissions.getPermissionsWithGrantOption()) { + if (!current.contains(p)) { + current.add(p); + } + } + existing.setPermissionsWithGrantOption(current); + } + permissionsStorage.put(key, existing); + } else { + permissionsStorage.put(key, permissions); + } + } + + @Override + public void revokePermissions(String region, String catalogId, PrincipalResourcePermissions permissions) { + String key = region + ":" + buildPermissionsKey(catalogId, permissions); + permissionsStorage.get(key).ifPresent(existing -> { + boolean empty = true; + if (existing.getPermissions() != null && permissions.getPermissions() != null) { + List current = new ArrayList<>(existing.getPermissions()); + current.removeAll(permissions.getPermissions()); + existing.setPermissions(current); + + if (existing.getPermissionsWithGrantOption() != null) { + List currentGrants = new ArrayList<>(existing.getPermissionsWithGrantOption()); + currentGrants.removeAll(permissions.getPermissions()); + existing.setPermissionsWithGrantOption(currentGrants); + } + } + + if (existing.getPermissionsWithGrantOption() != null && permissions.getPermissionsWithGrantOption() != null) { + List current = new ArrayList<>(existing.getPermissionsWithGrantOption()); + current.removeAll(permissions.getPermissionsWithGrantOption()); + existing.setPermissionsWithGrantOption(current); + } + + if (existing.getPermissions() != null && !existing.getPermissions().isEmpty()) { + empty = false; + } + if (existing.getPermissionsWithGrantOption() != null && !existing.getPermissionsWithGrantOption().isEmpty()) { + empty = false; + } + + if (empty) { + permissionsStorage.delete(key); + } else { + permissionsStorage.put(key, existing); + } + }); + } + + @Override + public List listPermissions(String region, String catalogId, DataLakePrincipal principal, Resource resource, String resourceType, boolean includeRelated, Integer maxResults, String nextToken) { + // Deliberate omission: MaxResults, NextToken, ResourceType, and IncludeRelated are ignored. + // All results fit on a single page, and SDKs tolerate unset optional filters. + String filterResourceKey = resource != null ? getResourceKey(resource) : null; + return permissionsStorage.scan(k -> k.startsWith(region + ":" + catalogId + ":")).stream() + .filter(p -> { + if (principal != null && principal.getDataLakePrincipalIdentifier() != null) { + if (p.getPrincipal() == null || !principal.getDataLakePrincipalIdentifier().equals(p.getPrincipal().getDataLakePrincipalIdentifier())) { + return false; + } + } + if (filterResourceKey != null) { + if (p.getResource() == null || !filterResourceKey.equals(getResourceKey(p.getResource()))) { + return false; + } + } + return true; + }) + .collect(Collectors.toList()); + } + + @Override + public void createLFTag(String region, String catalogId, String tagKey, List tagValues) { + LFTag tag = new LFTag(); + tag.setTagKey(tagKey); + tag.setTagValues(tagValues); + lfTagsStorage.put(region + ":" + catalogId + ":" + tagKey, tag); + } + + @Override + public Optional getLFTag(String region, String catalogId, String tagKey) { + return lfTagsStorage.get(region + ":" + catalogId + ":" + tagKey); + } + + @Override + public void updateLFTag(String region, String catalogId, String tagKey, List tagValuesToAdd, List tagValuesToDelete) { + lfTagsStorage.get(region + ":" + catalogId + ":" + tagKey).ifPresent(tag -> { + List currentValues = new ArrayList<>(tag.getTagValues() != null ? tag.getTagValues() : List.of()); + if (tagValuesToDelete != null) { + currentValues.removeAll(tagValuesToDelete); + } + if (tagValuesToAdd != null) { + for (String val : tagValuesToAdd) { + if (!currentValues.contains(val)) { + currentValues.add(val); + } + } + } + tag.setTagValues(currentValues); + lfTagsStorage.put(region + ":" + catalogId + ":" + tagKey, tag); + }); + } + + @Override + public void deleteLFTag(String region, String catalogId, String tagKey) { + lfTagsStorage.delete(region + ":" + catalogId + ":" + tagKey); + } + + @Override + public List listLFTags(String region, String catalogId, String resourceShareType, Integer maxResults, String nextToken) { + // Deliberate omission: MaxResults and NextToken are ignored. All results fit on a single page. + return lfTagsStorage.scan(k -> k.startsWith(region + ":" + catalogId + ":")).stream() + .map(tag -> { + LFTagPair pair = new LFTagPair(); + pair.setCatalogId(catalogId); + pair.setTagKey(tag.getTagKey()); + pair.setTagValues(tag.getTagValues()); + return pair; + }) + .collect(Collectors.toList()); + } + + @Override + public void addLFTagsToResource(String region, String catalogId, Resource resource, List lfTags) { + String resourceKey = region + ":" + catalogId + ":" + getResourceKey(resource); + List currentTags = resourceTagsStorage.get(resourceKey).orElse(new ArrayList<>()); + + for (LFTagPair newTag : lfTags) { + // Remove existing tag with same key if it exists, to replace values + currentTags.removeIf(t -> t.getTagKey().equals(newTag.getTagKey())); + currentTags.add(newTag); + } + + resourceTagsStorage.put(resourceKey, currentTags); + } + + @Override + public void removeLFTagsFromResource(String region, String catalogId, Resource resource, List lfTags) { + String resourceKey = region + ":" + catalogId + ":" + getResourceKey(resource); + resourceTagsStorage.get(resourceKey).ifPresent(currentTags -> { + for (LFTagPair tagToRemove : lfTags) { + for (LFTagPair currentTag : currentTags) { + if (currentTag.getTagKey().equals(tagToRemove.getTagKey())) { + if (currentTag.getTagValues() != null && tagToRemove.getTagValues() != null) { + List updatedValues = new ArrayList<>(currentTag.getTagValues()); + updatedValues.removeAll(tagToRemove.getTagValues()); + currentTag.setTagValues(updatedValues); + } + } + } + currentTags.removeIf(t -> t.getTagValues() != null && t.getTagValues().isEmpty()); + } + resourceTagsStorage.put(resourceKey, currentTags); + }); + } + + private String buildPermissionsKey(String catalogId, PrincipalResourcePermissions p) { + String principalId = p.getPrincipal() != null ? p.getPrincipal().getDataLakePrincipalIdentifier() : "unknown"; + String resourceKey = p.getResource() != null ? getResourceKey(p.getResource()) : "unknown"; + return catalogId + ":" + principalId + ":" + resourceKey; + } + + private String getResourceKey(Resource r) { + // Basic unique string representation of the resource union + if (r.getCatalog() != null) { + return "catalog:" + r.getCatalog().getId(); + } + if (r.getDatabase() != null) { + String cat = r.getDatabase().getCatalogId() != null ? "catalog:" + r.getDatabase().getCatalogId() + ":" : ""; + return cat + "database:" + r.getDatabase().getName(); + } + if (r.getTable() != null) { + String cat = r.getTable().getCatalogId() != null ? "catalog:" + r.getTable().getCatalogId() + ":" : ""; + return cat + "table:" + r.getTable().getDatabaseName() + ":" + r.getTable().getName(); + } + if (r.getTableWithColumns() != null) { + String cat = r.getTableWithColumns().getCatalogId() != null ? "catalog:" + r.getTableWithColumns().getCatalogId() + ":" : ""; + StringBuilder sb = new StringBuilder(cat + "tableWithColumns:" + r.getTableWithColumns().getDatabaseName() + ":" + r.getTableWithColumns().getName()); + if (r.getTableWithColumns().getColumnNames() != null && !r.getTableWithColumns().getColumnNames().isEmpty()) { + sb.append(":cols:").append(r.getTableWithColumns().getColumnNames().stream().map(c -> java.net.URLEncoder.encode(c, java.nio.charset.StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(","))); + } else if (r.getTableWithColumns().getColumnWildcard() != null) { + sb.append(":wildcard"); + if (r.getTableWithColumns().getColumnWildcard().getExcludedColumnNames() != null && !r.getTableWithColumns().getColumnWildcard().getExcludedColumnNames().isEmpty()) { + sb.append(":excl:").append(r.getTableWithColumns().getColumnWildcard().getExcludedColumnNames().stream().map(c -> java.net.URLEncoder.encode(c, java.nio.charset.StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(","))); + } + } + return sb.toString(); + } + if (r.getDataLocation() != null) { + String cat = r.getDataLocation().getCatalogId() != null ? "catalog:" + r.getDataLocation().getCatalogId() + ":" : ""; + return cat + "dataLocation:" + r.getDataLocation().getResourceArn(); + } + if (r.getDataCellsFilter() != null) { + String cat = r.getDataCellsFilter().getTableCatalogId() != null ? "catalog:" + r.getDataCellsFilter().getTableCatalogId() + ":" : ""; + return cat + "dataCellsFilter:" + r.getDataCellsFilter().getDatabaseName() + ":" + r.getDataCellsFilter().getTableName() + ":" + r.getDataCellsFilter().getName(); + } + if (r.getLfTag() != null) { + String cat = r.getLfTag().getCatalogId() != null ? "catalog:" + r.getLfTag().getCatalogId() + ":" : ""; + StringBuilder sb = new StringBuilder(cat + "lfTag:" + java.net.URLEncoder.encode(r.getLfTag().getTagKey(), java.nio.charset.StandardCharsets.UTF_8)); + if (r.getLfTag().getTagValues() != null) { + sb.append("=").append(r.getLfTag().getTagValues().stream().map(v -> java.net.URLEncoder.encode(v, java.nio.charset.StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(","))); + } + return sb.toString(); + } + if (r.getLfTagExpression() != null) { + String cat = r.getLfTagExpression().getCatalogId() != null ? "catalog:" + r.getLfTagExpression().getCatalogId() + ":" : ""; + return cat + "lfTagExpression:" + r.getLfTagExpression().getName(); + } + if (r.getLfTagPolicy() != null) { + String cat = r.getLfTagPolicy().getCatalogId() != null ? "catalog:" + r.getLfTagPolicy().getCatalogId() + ":" : ""; + StringBuilder sb = new StringBuilder(cat + "lfTagPolicy:" + r.getLfTagPolicy().getResourceType()); + if (r.getLfTagPolicy().getExpressionName() != null) { + sb.append(":exprName:").append(r.getLfTagPolicy().getExpressionName()); + } + if (r.getLfTagPolicy().getExpression() != null) { + sb.append(":expr:").append(r.getLfTagPolicy().getExpression().stream() + .map(e -> java.net.URLEncoder.encode(e.getTagKey(), java.nio.charset.StandardCharsets.UTF_8) + "=" + e.getTagValues().stream().map(v -> java.net.URLEncoder.encode(v, java.nio.charset.StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(","))) + .sorted().collect(Collectors.joining(";"))); + } + return sb.toString(); + } + return "unknown"; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/AddLFTagsToResourceRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/AddLFTagsToResourceRequest.java new file mode 100644 index 0000000000..e33e9c2e32 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/AddLFTagsToResourceRequest.java @@ -0,0 +1,42 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AddLFTagsToResourceRequest { + private String catalogId; + @JsonProperty("LFTags") + private List lfTags; + private Resource resource; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public List getLfTags() { + return lfTags; + } + + public void setLfTags(List lfTags) { + this.lfTags = lfTags; + } + + public Resource getResource() { + return resource; + } + + public void setResource(Resource resource) { + this.resource = resource; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/AddLFTagsToResourceResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/AddLFTagsToResourceResponse.java new file mode 100644 index 0000000000..d1dec2b6f1 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/AddLFTagsToResourceResponse.java @@ -0,0 +1,22 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AddLFTagsToResourceResponse { + private List failures; + + public List getFailures() { + return failures; + } + + public void setFailures(List failures) { + this.failures = failures; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/CatalogResource.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/CatalogResource.java new file mode 100644 index 0000000000..c550fa332d --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/CatalogResource.java @@ -0,0 +1,21 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CatalogResource { + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ColumnWildcard.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ColumnWildcard.java new file mode 100644 index 0000000000..1a33b02f14 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ColumnWildcard.java @@ -0,0 +1,22 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ColumnWildcard { + private List excludedColumnNames; + + public List getExcludedColumnNames() { + return excludedColumnNames; + } + + public void setExcludedColumnNames(List excludedColumnNames) { + this.excludedColumnNames = excludedColumnNames; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/Condition.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/Condition.java new file mode 100644 index 0000000000..0f08b9268a --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/Condition.java @@ -0,0 +1,21 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Condition { + private String expression; + + public String getExpression() { + return expression; + } + + public void setExpression(String expression) { + this.expression = expression; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/CreateLFTagRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/CreateLFTagRequest.java new file mode 100644 index 0000000000..66386ee6a3 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/CreateLFTagRequest.java @@ -0,0 +1,40 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CreateLFTagRequest { + private String catalogId; + private String tagKey; + private List tagValues; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + public List getTagValues() { + return tagValues; + } + + public void setTagValues(List tagValues) { + this.tagValues = tagValues; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/CreateLFTagResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/CreateLFTagResponse.java new file mode 100644 index 0000000000..17cb1a2134 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/CreateLFTagResponse.java @@ -0,0 +1,13 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CreateLFTagResponse { + // Empty response +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataCellsFilterResource.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataCellsFilterResource.java new file mode 100644 index 0000000000..e3a76312b0 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataCellsFilterResource.java @@ -0,0 +1,48 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DataCellsFilterResource { + private String databaseName; + private String name; + private String tableCatalogId; + private String tableName; + + public String getDatabaseName() { + return databaseName; + } + + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTableCatalogId() { + return tableCatalogId; + } + + public void setTableCatalogId(String tableCatalogId) { + this.tableCatalogId = tableCatalogId; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataLakePrincipal.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataLakePrincipal.java new file mode 100644 index 0000000000..767719d9d4 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataLakePrincipal.java @@ -0,0 +1,22 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DataLakePrincipal { + + private String dataLakePrincipalIdentifier; + + public String getDataLakePrincipalIdentifier() { + return dataLakePrincipalIdentifier; + } + + public void setDataLakePrincipalIdentifier(String dataLakePrincipalIdentifier) { + this.dataLakePrincipalIdentifier = dataLakePrincipalIdentifier; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataLakeSettings.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataLakeSettings.java new file mode 100644 index 0000000000..b9b7e3342b --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataLakeSettings.java @@ -0,0 +1,105 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DataLakeSettings { + + private Boolean allowExternalDataFiltering; + private Boolean allowFullTableExternalDataAccess; + private List authorizedSessionTagValueList; + private List createDatabaseDefaultPermissions; + private List createTableDefaultPermissions; + private List dataLakeAdmins; + private List externalDataFilteringAllowList; + private Map parameters; + private List readOnlyAdmins; + private List trustedResourceOwners; + + public Boolean getAllowExternalDataFiltering() { + return allowExternalDataFiltering; + } + + public void setAllowExternalDataFiltering(Boolean allowExternalDataFiltering) { + this.allowExternalDataFiltering = allowExternalDataFiltering; + } + + public Boolean getAllowFullTableExternalDataAccess() { + return allowFullTableExternalDataAccess; + } + + public void setAllowFullTableExternalDataAccess(Boolean allowFullTableExternalDataAccess) { + this.allowFullTableExternalDataAccess = allowFullTableExternalDataAccess; + } + + public List getAuthorizedSessionTagValueList() { + return authorizedSessionTagValueList; + } + + public void setAuthorizedSessionTagValueList(List authorizedSessionTagValueList) { + this.authorizedSessionTagValueList = authorizedSessionTagValueList; + } + + public List getCreateDatabaseDefaultPermissions() { + return createDatabaseDefaultPermissions; + } + + public void setCreateDatabaseDefaultPermissions(List createDatabaseDefaultPermissions) { + this.createDatabaseDefaultPermissions = createDatabaseDefaultPermissions; + } + + public List getCreateTableDefaultPermissions() { + return createTableDefaultPermissions; + } + + public void setCreateTableDefaultPermissions(List createTableDefaultPermissions) { + this.createTableDefaultPermissions = createTableDefaultPermissions; + } + + public List getDataLakeAdmins() { + return dataLakeAdmins; + } + + public void setDataLakeAdmins(List dataLakeAdmins) { + this.dataLakeAdmins = dataLakeAdmins; + } + + public List getExternalDataFilteringAllowList() { + return externalDataFilteringAllowList; + } + + public void setExternalDataFilteringAllowList(List externalDataFilteringAllowList) { + this.externalDataFilteringAllowList = externalDataFilteringAllowList; + } + + public Map getParameters() { + return parameters; + } + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + public List getReadOnlyAdmins() { + return readOnlyAdmins; + } + + public void setReadOnlyAdmins(List readOnlyAdmins) { + this.readOnlyAdmins = readOnlyAdmins; + } + + public List getTrustedResourceOwners() { + return trustedResourceOwners; + } + + public void setTrustedResourceOwners(List trustedResourceOwners) { + this.trustedResourceOwners = trustedResourceOwners; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataLocationResource.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataLocationResource.java new file mode 100644 index 0000000000..3f1e863b31 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DataLocationResource.java @@ -0,0 +1,30 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DataLocationResource { + private String catalogId; + private String resourceArn; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getResourceArn() { + return resourceArn; + } + + public void setResourceArn(String resourceArn) { + this.resourceArn = resourceArn; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DatabaseResource.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DatabaseResource.java new file mode 100644 index 0000000000..16f69f4824 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DatabaseResource.java @@ -0,0 +1,30 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DatabaseResource { + private String catalogId; + private String name; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeleteLFTagRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeleteLFTagRequest.java new file mode 100644 index 0000000000..46072720b4 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeleteLFTagRequest.java @@ -0,0 +1,30 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DeleteLFTagRequest { + private String catalogId; + private String tagKey; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeleteLFTagResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeleteLFTagResponse.java new file mode 100644 index 0000000000..410121ca5f --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeleteLFTagResponse.java @@ -0,0 +1,13 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DeleteLFTagResponse { + // Empty response +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeregisterResourceRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeregisterResourceRequest.java new file mode 100644 index 0000000000..5005b8d647 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeregisterResourceRequest.java @@ -0,0 +1,22 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DeregisterResourceRequest { + + private String resourceArn; + + public String getResourceArn() { + return resourceArn; + } + + public void setResourceArn(String resourceArn) { + this.resourceArn = resourceArn; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeregisterResourceResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeregisterResourceResponse.java new file mode 100644 index 0000000000..89e6639b77 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DeregisterResourceResponse.java @@ -0,0 +1,13 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DeregisterResourceResponse { + // Empty response +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DescribeResourceRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DescribeResourceRequest.java new file mode 100644 index 0000000000..20bb54a2c3 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DescribeResourceRequest.java @@ -0,0 +1,22 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DescribeResourceRequest { + + private String resourceArn; + + public String getResourceArn() { + return resourceArn; + } + + public void setResourceArn(String resourceArn) { + this.resourceArn = resourceArn; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DescribeResourceResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DescribeResourceResponse.java new file mode 100644 index 0000000000..42a15d96b6 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DescribeResourceResponse.java @@ -0,0 +1,22 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DescribeResourceResponse { + + private ResourceInfo resourceInfo; + + public ResourceInfo getResourceInfo() { + return resourceInfo; + } + + public void setResourceInfo(ResourceInfo resourceInfo) { + this.resourceInfo = resourceInfo; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DetailsMap.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DetailsMap.java new file mode 100644 index 0000000000..341df186c1 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/DetailsMap.java @@ -0,0 +1,22 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DetailsMap { + private List resourceShare; + + public List getResourceShare() { + return resourceShare; + } + + public void setResourceShare(List resourceShare) { + this.resourceShare = resourceShare; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ErrorDetail.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ErrorDetail.java new file mode 100644 index 0000000000..f499e968f6 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ErrorDetail.java @@ -0,0 +1,30 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ErrorDetail { + private String errorCode; + private String errorMessage; + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/FilterCondition.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/FilterCondition.java new file mode 100644 index 0000000000..db10ba9b75 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/FilterCondition.java @@ -0,0 +1,41 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class FilterCondition { + + private String comparisonOperator; + private String field; + private List stringValueList; + + public String getComparisonOperator() { + return comparisonOperator; + } + + public void setComparisonOperator(String comparisonOperator) { + this.comparisonOperator = comparisonOperator; + } + + public String getField() { + return field; + } + + public void setField(String field) { + this.field = field; + } + + public List getStringValueList() { + return stringValueList; + } + + public void setStringValueList(List stringValueList) { + this.stringValueList = stringValueList; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetDataLakeSettingsRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetDataLakeSettingsRequest.java new file mode 100644 index 0000000000..e4b119171a --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetDataLakeSettingsRequest.java @@ -0,0 +1,22 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GetDataLakeSettingsRequest { + + private String catalogId; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetDataLakeSettingsResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetDataLakeSettingsResponse.java new file mode 100644 index 0000000000..99cedc811e --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetDataLakeSettingsResponse.java @@ -0,0 +1,22 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GetDataLakeSettingsResponse { + + private DataLakeSettings dataLakeSettings; + + public DataLakeSettings getDataLakeSettings() { + return dataLakeSettings; + } + + public void setDataLakeSettings(DataLakeSettings dataLakeSettings) { + this.dataLakeSettings = dataLakeSettings; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetLFTagRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetLFTagRequest.java new file mode 100644 index 0000000000..f9a1dea6b5 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetLFTagRequest.java @@ -0,0 +1,30 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GetLFTagRequest { + private String catalogId; + private String tagKey; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetLFTagResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetLFTagResponse.java new file mode 100644 index 0000000000..db34b30bb1 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GetLFTagResponse.java @@ -0,0 +1,40 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GetLFTagResponse { + private String catalogId; + private String tagKey; + private List tagValues; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + public List getTagValues() { + return tagValues; + } + + public void setTagValues(List tagValues) { + this.tagValues = tagValues; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GrantPermissionsRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GrantPermissionsRequest.java new file mode 100644 index 0000000000..6184be67a2 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GrantPermissionsRequest.java @@ -0,0 +1,67 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GrantPermissionsRequest { + private String catalogId; + private Condition condition; + private List permissions; + private List permissionsWithGrantOption; + private DataLakePrincipal principal; + private Resource resource; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public Condition getCondition() { + return condition; + } + + public void setCondition(Condition condition) { + this.condition = condition; + } + + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + + public List getPermissionsWithGrantOption() { + return permissionsWithGrantOption; + } + + public void setPermissionsWithGrantOption(List permissionsWithGrantOption) { + this.permissionsWithGrantOption = permissionsWithGrantOption; + } + + public DataLakePrincipal getPrincipal() { + return principal; + } + + public void setPrincipal(DataLakePrincipal principal) { + this.principal = principal; + } + + public Resource getResource() { + return resource; + } + + public void setResource(Resource resource) { + this.resource = resource; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GrantPermissionsResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GrantPermissionsResponse.java new file mode 100644 index 0000000000..e7ca975c25 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/GrantPermissionsResponse.java @@ -0,0 +1,13 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GrantPermissionsResponse { + // Empty response +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTag.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTag.java new file mode 100644 index 0000000000..4367c77538 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTag.java @@ -0,0 +1,31 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class LFTag { + private String tagKey; + private List tagValues; + + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + public List getTagValues() { + return tagValues; + } + + public void setTagValues(List tagValues) { + this.tagValues = tagValues; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagError.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagError.java new file mode 100644 index 0000000000..dc8d7332ec --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagError.java @@ -0,0 +1,32 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class LFTagError { + private ErrorDetail error; + @JsonProperty("LFTag") + private LFTagPair lfTag; + + public ErrorDetail getError() { + return error; + } + + public void setError(ErrorDetail error) { + this.error = error; + } + + public LFTagPair getLfTag() { + return lfTag; + } + + public void setLfTag(LFTagPair lfTag) { + this.lfTag = lfTag; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagExpressionResource.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagExpressionResource.java new file mode 100644 index 0000000000..9d22b6d7c2 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagExpressionResource.java @@ -0,0 +1,30 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class LFTagExpressionResource { + private String catalogId; + private String name; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagKeyResource.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagKeyResource.java new file mode 100644 index 0000000000..cbcd3f28e3 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagKeyResource.java @@ -0,0 +1,40 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class LFTagKeyResource { + private String catalogId; + private String tagKey; + private List tagValues; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + public List getTagValues() { + return tagValues; + } + + public void setTagValues(List tagValues) { + this.tagValues = tagValues; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagPair.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagPair.java new file mode 100644 index 0000000000..76826f240e --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagPair.java @@ -0,0 +1,40 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class LFTagPair { + private String catalogId; + private String tagKey; + private List tagValues; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + public List getTagValues() { + return tagValues; + } + + public void setTagValues(List tagValues) { + this.tagValues = tagValues; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagPolicyResource.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagPolicyResource.java new file mode 100644 index 0000000000..67ab34e044 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/LFTagPolicyResource.java @@ -0,0 +1,49 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class LFTagPolicyResource { + private String catalogId; + private List expression; + private String expressionName; + private String resourceType; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public List getExpression() { + return expression; + } + + public void setExpression(List expression) { + this.expression = expression; + } + + public String getExpressionName() { + return expressionName; + } + + public void setExpressionName(String expressionName) { + this.expressionName = expressionName; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListLFTagsRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListLFTagsRequest.java new file mode 100644 index 0000000000..d0815ab5da --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListLFTagsRequest.java @@ -0,0 +1,48 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ListLFTagsRequest { + private String catalogId; + private Integer maxResults; + private String nextToken; + private String resourceShareType; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public Integer getMaxResults() { + return maxResults; + } + + public void setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + } + + public String getNextToken() { + return nextToken; + } + + public void setNextToken(String nextToken) { + this.nextToken = nextToken; + } + + public String getResourceShareType() { + return resourceShareType; + } + + public void setResourceShareType(String resourceShareType) { + this.resourceShareType = resourceShareType; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListLFTagsResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListLFTagsResponse.java new file mode 100644 index 0000000000..2cac70a041 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListLFTagsResponse.java @@ -0,0 +1,33 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ListLFTagsResponse { + @JsonProperty("LFTags") + private List lfTags; + private String nextToken; + + public List getLfTags() { + return lfTags; + } + + public void setLfTags(List lfTags) { + this.lfTags = lfTags; + } + + public String getNextToken() { + return nextToken; + } + + public void setNextToken(String nextToken) { + this.nextToken = nextToken; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListPermissionsRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListPermissionsRequest.java new file mode 100644 index 0000000000..e83ab46fff --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListPermissionsRequest.java @@ -0,0 +1,75 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ListPermissionsRequest { + private String catalogId; + private String includeRelated; + private Integer maxResults; + private String nextToken; + private DataLakePrincipal principal; + private Resource resource; + private String resourceType; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getIncludeRelated() { + return includeRelated; + } + + public void setIncludeRelated(String includeRelated) { + this.includeRelated = includeRelated; + } + + public Integer getMaxResults() { + return maxResults; + } + + public void setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + } + + public String getNextToken() { + return nextToken; + } + + public void setNextToken(String nextToken) { + this.nextToken = nextToken; + } + + public DataLakePrincipal getPrincipal() { + return principal; + } + + public void setPrincipal(DataLakePrincipal principal) { + this.principal = principal; + } + + public Resource getResource() { + return resource; + } + + public void setResource(Resource resource) { + this.resource = resource; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListPermissionsResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListPermissionsResponse.java new file mode 100644 index 0000000000..a616489a06 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListPermissionsResponse.java @@ -0,0 +1,31 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ListPermissionsResponse { + private String nextToken; + private List principalResourcePermissions; + + public String getNextToken() { + return nextToken; + } + + public void setNextToken(String nextToken) { + this.nextToken = nextToken; + } + + public List getPrincipalResourcePermissions() { + return principalResourcePermissions; + } + + public void setPrincipalResourcePermissions(List principalResourcePermissions) { + this.principalResourcePermissions = principalResourcePermissions; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListResourcesRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListResourcesRequest.java new file mode 100644 index 0000000000..2eb409e5ce --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListResourcesRequest.java @@ -0,0 +1,41 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ListResourcesRequest { + + private List filterConditionList; + private Integer maxResults; + private String nextToken; + + public List getFilterConditionList() { + return filterConditionList; + } + + public void setFilterConditionList(List filterConditionList) { + this.filterConditionList = filterConditionList; + } + + public Integer getMaxResults() { + return maxResults; + } + + public void setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + } + + public String getNextToken() { + return nextToken; + } + + public void setNextToken(String nextToken) { + this.nextToken = nextToken; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListResourcesResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListResourcesResponse.java new file mode 100644 index 0000000000..79eec74912 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ListResourcesResponse.java @@ -0,0 +1,32 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ListResourcesResponse { + + private String nextToken; + private List resourceInfoList; + + public String getNextToken() { + return nextToken; + } + + public void setNextToken(String nextToken) { + this.nextToken = nextToken; + } + + public List getResourceInfoList() { + return resourceInfoList; + } + + public void setResourceInfoList(List resourceInfoList) { + this.resourceInfoList = resourceInfoList; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PrincipalPermissions.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PrincipalPermissions.java new file mode 100644 index 0000000000..e53ec65ef9 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PrincipalPermissions.java @@ -0,0 +1,32 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PrincipalPermissions { + + private List permissions; + private DataLakePrincipal principal; + + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + + public DataLakePrincipal getPrincipal() { + return principal; + } + + public void setPrincipal(DataLakePrincipal principal) { + this.principal = principal; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PrincipalResourcePermissions.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PrincipalResourcePermissions.java new file mode 100644 index 0000000000..f5b7fad003 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PrincipalResourcePermissions.java @@ -0,0 +1,85 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PrincipalResourcePermissions { + private DetailsMap additionalDetails; + private Condition condition; + private Long lastUpdated; + private String lastUpdatedBy; + private List permissions; + private List permissionsWithGrantOption; + private DataLakePrincipal principal; + private Resource resource; + + public DetailsMap getAdditionalDetails() { + return additionalDetails; + } + + public void setAdditionalDetails(DetailsMap additionalDetails) { + this.additionalDetails = additionalDetails; + } + + public Condition getCondition() { + return condition; + } + + public void setCondition(Condition condition) { + this.condition = condition; + } + + public Long getLastUpdated() { + return lastUpdated; + } + + public void setLastUpdated(Long lastUpdated) { + this.lastUpdated = lastUpdated; + } + + public String getLastUpdatedBy() { + return lastUpdatedBy; + } + + public void setLastUpdatedBy(String lastUpdatedBy) { + this.lastUpdatedBy = lastUpdatedBy; + } + + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + + public List getPermissionsWithGrantOption() { + return permissionsWithGrantOption; + } + + public void setPermissionsWithGrantOption(List permissionsWithGrantOption) { + this.permissionsWithGrantOption = permissionsWithGrantOption; + } + + public DataLakePrincipal getPrincipal() { + return principal; + } + + public void setPrincipal(DataLakePrincipal principal) { + this.principal = principal; + } + + public Resource getResource() { + return resource; + } + + public void setResource(Resource resource) { + this.resource = resource; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PutDataLakeSettingsRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PutDataLakeSettingsRequest.java new file mode 100644 index 0000000000..5965df6d97 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PutDataLakeSettingsRequest.java @@ -0,0 +1,31 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PutDataLakeSettingsRequest { + + private String catalogId; + private DataLakeSettings dataLakeSettings; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public DataLakeSettings getDataLakeSettings() { + return dataLakeSettings; + } + + public void setDataLakeSettings(DataLakeSettings dataLakeSettings) { + this.dataLakeSettings = dataLakeSettings; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PutDataLakeSettingsResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PutDataLakeSettingsResponse.java new file mode 100644 index 0000000000..12f54cfd89 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/PutDataLakeSettingsResponse.java @@ -0,0 +1,12 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PutDataLakeSettingsResponse { +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RegisterResourceRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RegisterResourceRequest.java new file mode 100644 index 0000000000..3d1320b3d5 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RegisterResourceRequest.java @@ -0,0 +1,76 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class RegisterResourceRequest { + + private String expectedResourceOwnerAccount; + private Boolean hybridAccessEnabled; + private String resourceArn; + private String roleArn; + private Boolean useServiceLinkedRole; + private Boolean withFederation; + private Boolean withPrivilegedAccess; + + public String getExpectedResourceOwnerAccount() { + return expectedResourceOwnerAccount; + } + + public void setExpectedResourceOwnerAccount(String expectedResourceOwnerAccount) { + this.expectedResourceOwnerAccount = expectedResourceOwnerAccount; + } + + public Boolean getHybridAccessEnabled() { + return hybridAccessEnabled; + } + + public void setHybridAccessEnabled(Boolean hybridAccessEnabled) { + this.hybridAccessEnabled = hybridAccessEnabled; + } + + public String getResourceArn() { + return resourceArn; + } + + public void setResourceArn(String resourceArn) { + this.resourceArn = resourceArn; + } + + public String getRoleArn() { + return roleArn; + } + + public void setRoleArn(String roleArn) { + this.roleArn = roleArn; + } + + public Boolean getUseServiceLinkedRole() { + return useServiceLinkedRole; + } + + public void setUseServiceLinkedRole(Boolean useServiceLinkedRole) { + this.useServiceLinkedRole = useServiceLinkedRole; + } + + public Boolean getWithFederation() { + return withFederation; + } + + public void setWithFederation(Boolean withFederation) { + this.withFederation = withFederation; + } + + public Boolean getWithPrivilegedAccess() { + return withPrivilegedAccess; + } + + public void setWithPrivilegedAccess(Boolean withPrivilegedAccess) { + this.withPrivilegedAccess = withPrivilegedAccess; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RegisterResourceResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RegisterResourceResponse.java new file mode 100644 index 0000000000..4bf2460dd5 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RegisterResourceResponse.java @@ -0,0 +1,13 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class RegisterResourceResponse { + // Empty response +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RemoveLFTagsFromResourceRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RemoveLFTagsFromResourceRequest.java new file mode 100644 index 0000000000..81b09bc153 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RemoveLFTagsFromResourceRequest.java @@ -0,0 +1,42 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class RemoveLFTagsFromResourceRequest { + private String catalogId; + @JsonProperty("LFTags") + private List lfTags; + private Resource resource; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public List getLfTags() { + return lfTags; + } + + public void setLfTags(List lfTags) { + this.lfTags = lfTags; + } + + public Resource getResource() { + return resource; + } + + public void setResource(Resource resource) { + this.resource = resource; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RemoveLFTagsFromResourceResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RemoveLFTagsFromResourceResponse.java new file mode 100644 index 0000000000..7025625381 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RemoveLFTagsFromResourceResponse.java @@ -0,0 +1,22 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class RemoveLFTagsFromResourceResponse { + private List failures; + + public List getFailures() { + return failures; + } + + public void setFailures(List failures) { + this.failures = failures; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/Resource.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/Resource.java new file mode 100644 index 0000000000..887e714f14 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/Resource.java @@ -0,0 +1,97 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Resource { + private CatalogResource catalog; + private DatabaseResource database; + private DataCellsFilterResource dataCellsFilter; + private DataLocationResource dataLocation; + @JsonProperty("LFTag") + private LFTagKeyResource lfTag; + @JsonProperty("LFTagExpression") + private LFTagExpressionResource lfTagExpression; + @JsonProperty("LFTagPolicy") + private LFTagPolicyResource lfTagPolicy; + private TableResource table; + private TableWithColumnsResource tableWithColumns; + + public CatalogResource getCatalog() { + return catalog; + } + + public void setCatalog(CatalogResource catalog) { + this.catalog = catalog; + } + + public DatabaseResource getDatabase() { + return database; + } + + public void setDatabase(DatabaseResource database) { + this.database = database; + } + + public DataCellsFilterResource getDataCellsFilter() { + return dataCellsFilter; + } + + public void setDataCellsFilter(DataCellsFilterResource dataCellsFilter) { + this.dataCellsFilter = dataCellsFilter; + } + + public DataLocationResource getDataLocation() { + return dataLocation; + } + + public void setDataLocation(DataLocationResource dataLocation) { + this.dataLocation = dataLocation; + } + + public LFTagKeyResource getLfTag() { + return lfTag; + } + + public void setLfTag(LFTagKeyResource lfTag) { + this.lfTag = lfTag; + } + + public LFTagExpressionResource getLfTagExpression() { + return lfTagExpression; + } + + public void setLfTagExpression(LFTagExpressionResource lfTagExpression) { + this.lfTagExpression = lfTagExpression; + } + + public LFTagPolicyResource getLfTagPolicy() { + return lfTagPolicy; + } + + public void setLfTagPolicy(LFTagPolicyResource lfTagPolicy) { + this.lfTagPolicy = lfTagPolicy; + } + + public TableResource getTable() { + return table; + } + + public void setTable(TableResource table) { + this.table = table; + } + + public TableWithColumnsResource getTableWithColumns() { + return tableWithColumns; + } + + public void setTableWithColumns(TableWithColumnsResource tableWithColumns) { + this.tableWithColumns = tableWithColumns; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ResourceInfo.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ResourceInfo.java new file mode 100644 index 0000000000..6df5f9c40a --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/ResourceInfo.java @@ -0,0 +1,85 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ResourceInfo { + + private String expectedResourceOwnerAccount; + private Boolean hybridAccessEnabled; + private Long lastModified; + private String resourceArn; + private String roleArn; + private String verificationStatus; + private Boolean withFederation; + private Boolean withPrivilegedAccess; + + public String getExpectedResourceOwnerAccount() { + return expectedResourceOwnerAccount; + } + + public void setExpectedResourceOwnerAccount(String expectedResourceOwnerAccount) { + this.expectedResourceOwnerAccount = expectedResourceOwnerAccount; + } + + public Boolean getHybridAccessEnabled() { + return hybridAccessEnabled; + } + + public void setHybridAccessEnabled(Boolean hybridAccessEnabled) { + this.hybridAccessEnabled = hybridAccessEnabled; + } + + public Long getLastModified() { + return lastModified; + } + + public void setLastModified(Long lastModified) { + this.lastModified = lastModified; + } + + public String getResourceArn() { + return resourceArn; + } + + public void setResourceArn(String resourceArn) { + this.resourceArn = resourceArn; + } + + public String getRoleArn() { + return roleArn; + } + + public void setRoleArn(String roleArn) { + this.roleArn = roleArn; + } + + public String getVerificationStatus() { + return verificationStatus; + } + + public void setVerificationStatus(String verificationStatus) { + this.verificationStatus = verificationStatus; + } + + public Boolean getWithFederation() { + return withFederation; + } + + public void setWithFederation(Boolean withFederation) { + this.withFederation = withFederation; + } + + public Boolean getWithPrivilegedAccess() { + return withPrivilegedAccess; + } + + public void setWithPrivilegedAccess(Boolean withPrivilegedAccess) { + this.withPrivilegedAccess = withPrivilegedAccess; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RevokePermissionsRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RevokePermissionsRequest.java new file mode 100644 index 0000000000..e39a68228d --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RevokePermissionsRequest.java @@ -0,0 +1,67 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class RevokePermissionsRequest { + private String catalogId; + private Condition condition; + private List permissions; + private List permissionsWithGrantOption; + private DataLakePrincipal principal; + private Resource resource; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public Condition getCondition() { + return condition; + } + + public void setCondition(Condition condition) { + this.condition = condition; + } + + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + + public List getPermissionsWithGrantOption() { + return permissionsWithGrantOption; + } + + public void setPermissionsWithGrantOption(List permissionsWithGrantOption) { + this.permissionsWithGrantOption = permissionsWithGrantOption; + } + + public DataLakePrincipal getPrincipal() { + return principal; + } + + public void setPrincipal(DataLakePrincipal principal) { + this.principal = principal; + } + + public Resource getResource() { + return resource; + } + + public void setResource(Resource resource) { + this.resource = resource; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RevokePermissionsResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RevokePermissionsResponse.java new file mode 100644 index 0000000000..69b7000fbe --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/RevokePermissionsResponse.java @@ -0,0 +1,13 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class RevokePermissionsResponse { + // Empty response +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/TableResource.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/TableResource.java new file mode 100644 index 0000000000..65962fa705 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/TableResource.java @@ -0,0 +1,48 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TableResource { + private String catalogId; + private String databaseName; + private String name; + private TableWildcard tableWildcard; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getDatabaseName() { + return databaseName; + } + + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public TableWildcard getTableWildcard() { + return tableWildcard; + } + + public void setTableWildcard(TableWildcard tableWildcard) { + this.tableWildcard = tableWildcard; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/TableWildcard.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/TableWildcard.java new file mode 100644 index 0000000000..2b1f409a99 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/TableWildcard.java @@ -0,0 +1,13 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TableWildcard { + // Empty class +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/TableWithColumnsResource.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/TableWithColumnsResource.java new file mode 100644 index 0000000000..49ac6ab379 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/TableWithColumnsResource.java @@ -0,0 +1,58 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TableWithColumnsResource { + private String catalogId; + private List columnNames; + private ColumnWildcard columnWildcard; + private String databaseName; + private String name; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public List getColumnNames() { + return columnNames; + } + + public void setColumnNames(List columnNames) { + this.columnNames = columnNames; + } + + public ColumnWildcard getColumnWildcard() { + return columnWildcard; + } + + public void setColumnWildcard(ColumnWildcard columnWildcard) { + this.columnWildcard = columnWildcard; + } + + public String getDatabaseName() { + return databaseName; + } + + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/UpdateLFTagRequest.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/UpdateLFTagRequest.java new file mode 100644 index 0000000000..e3a981dfd3 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/UpdateLFTagRequest.java @@ -0,0 +1,49 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; +import java.util.List; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class UpdateLFTagRequest { + private String catalogId; + private String tagKey; + private List tagValuesToAdd; + private List tagValuesToDelete; + + public String getCatalogId() { + return catalogId; + } + + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } + + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + public List getTagValuesToAdd() { + return tagValuesToAdd; + } + + public void setTagValuesToAdd(List tagValuesToAdd) { + this.tagValuesToAdd = tagValuesToAdd; + } + + public List getTagValuesToDelete() { + return tagValuesToDelete; + } + + public void setTagValuesToDelete(List tagValuesToDelete) { + this.tagValuesToDelete = tagValuesToDelete; + } +} diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/UpdateLFTagResponse.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/UpdateLFTagResponse.java new file mode 100644 index 0000000000..7cc9bf98b7 --- /dev/null +++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/model/UpdateLFTagResponse.java @@ -0,0 +1,13 @@ +package io.github.hectorvent.floci.services.lakeformation.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.quarkus.runtime.annotations.RegisterForReflection; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +@RegisterForReflection +@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class UpdateLFTagResponse { + // Empty response +} diff --git a/src/main/java/io/github/hectorvent/floci/services/resourceexplorer2/ResourceExplorer2Controller.java b/src/main/java/io/github/hectorvent/floci/services/resourceexplorer2/ResourceExplorer2Controller.java index 86b5620a68..4c6400b72c 100644 --- a/src/main/java/io/github/hectorvent/floci/services/resourceexplorer2/ResourceExplorer2Controller.java +++ b/src/main/java/io/github/hectorvent/floci/services/resourceexplorer2/ResourceExplorer2Controller.java @@ -47,7 +47,7 @@ public class ResourceExplorer2Controller { } @POST - @Path("/ListResources") + @Path("/re2/ListResources") public Response listResources(@Context HttpHeaders headers, String body) throws IOException { JsonNode req = parseBody(body); String region = regionResolver.resolveRegion(headers); diff --git a/src/main/java/io/github/hectorvent/floci/services/resourceexplorer2/ResourceExplorer2PathRewriteFilter.java b/src/main/java/io/github/hectorvent/floci/services/resourceexplorer2/ResourceExplorer2PathRewriteFilter.java index d2debba682..804988cb51 100644 --- a/src/main/java/io/github/hectorvent/floci/services/resourceexplorer2/ResourceExplorer2PathRewriteFilter.java +++ b/src/main/java/io/github/hectorvent/floci/services/resourceexplorer2/ResourceExplorer2PathRewriteFilter.java @@ -38,7 +38,8 @@ public class ResourceExplorer2PathRewriteFilter implements ContainerRequestFilte "/CreateIndex", "/GetIndex", "/ListIndexes", - "/DeleteIndex" + "/DeleteIndex", + "/ListResources" ); private final ResolvedServiceCatalog catalog; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 76dbab39b6..91c80456d7 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -166,6 +166,8 @@ floci: flush-interval-ms: 5000 emrserverless: flush-interval-ms: 5000 + lakeformation: + flush-interval-ms: 5000 dns: # Extra hostname suffixes resolved to Floci's container IP by the embedded DNS server. @@ -545,6 +547,8 @@ floci: enabled: true emrserverless: enabled: true + lakeformation: + enabled: true tagging: enabled: true pipes: diff --git a/src/test/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationIntegrationTest.java new file mode 100644 index 0000000000..d3e9c76e11 --- /dev/null +++ b/src/test/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationIntegrationTest.java @@ -0,0 +1,360 @@ +package io.github.hectorvent.floci.services.lakeformation; + +import io.github.hectorvent.floci.testing.RestAssuredJsonUtils; +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.TestMethodOrder; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.*; + +@QuarkusTest +@TestMethodOrder(MethodOrderer.MethodName.class) +class LakeFormationIntegrationTest { + + @BeforeAll + static void configureRestAssured() { + RestAssuredJsonUtils.configureAwsContentTypes(); + } + + private static final String CONTENT_TYPE = "application/json"; + private static final String AUTH_HEADER = "AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20201022/us-east-1/lakeformation/aws4_request, SignedHeaders=host;x-amz-date, Signature=dummy"; + + + + + @Test + void putAndGetDataLakeSettings() { + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"DataLakeSettings\":{\"DataLakeAdmins\":[{\"DataLakePrincipalIdentifier\":\"arn:aws:iam::111122223333:user/admin\"}]}}") + .when() + .post("/PutDataLakeSettings") + .then() + .statusCode(200); + + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{}") + .when() + .post("/GetDataLakeSettings") + .then() + .statusCode(200) + .body("DataLakeSettings.DataLakeAdmins[0].DataLakePrincipalIdentifier", equalTo("arn:aws:iam::111122223333:user/admin")); + } + + @Test + void createAndGetLFTag() { + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"TagKey\":\"department\",\"TagValues\":[\"sales\",\"engineering\"]}") + .when() + .post("/CreateLFTag") + .then() + .statusCode(200); + + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"TagKey\":\"department\"}") + .when() + .post("/GetLFTag") + .then() + .statusCode(200) + .body("TagKey", equalTo("department")) + .body("TagValues", containsInAnyOrder("sales", "engineering")); + } + + @Test + void updateLFTag() { + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"TagKey\":\"department2\",\"TagValues\":[\"sales\"]}") + .when() + .post("/CreateLFTag") + .then() + .statusCode(200); + + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"TagKey\":\"department2\",\"TagValuesToAdd\":[\"marketing\"],\"TagValuesToDelete\":[\"sales\"]}") + .when() + .post("/UpdateLFTag") + .then() + .statusCode(200); + + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"TagKey\":\"department2\"}") + .when() + .post("/GetLFTag") + .then() + .statusCode(200) + .body("TagKey", equalTo("department2")) + .body("TagValues", contains("marketing")); + } + + @Test + void grantAndListPermissions() { + String grantBody = "{" + + "\"Principal\":{\"DataLakePrincipalIdentifier\":\"arn:aws:iam::111122223333:role/my-role\"}," + + "\"Resource\":{\"Table\":{\"DatabaseName\":\"default\",\"Name\":\"my-table\"}}," + + "\"Permissions\":[\"SELECT\",\"INSERT\"]" + + "}"; + + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body(grantBody) + .when() + .post("/GrantPermissions") + .then() + .statusCode(200); + + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{}") + .when() + .post("/ListPermissions") + .then() + .statusCode(200) + .body("PrincipalResourcePermissions[0].Principal.DataLakePrincipalIdentifier", equalTo("arn:aws:iam::111122223333:role/my-role")) + .body("PrincipalResourcePermissions[0].Resource.Table.DatabaseName", equalTo("default")) + .body("PrincipalResourcePermissions[0].Resource.Table.Name", equalTo("my-table")) + .body("PrincipalResourcePermissions[0].Permissions", containsInAnyOrder("SELECT", "INSERT")); + } + + @Test + void revokePermissions() { + String grantBody = "{" + + "\"Principal\":{\"DataLakePrincipalIdentifier\":\"arn:aws:iam::111122223333:role/my-role\"}," + + "\"Resource\":{\"Table\":{\"DatabaseName\":\"default\",\"Name\":\"my-table\"}}," + + "\"Permissions\":[\"SELECT\",\"INSERT\"]" + + "}"; + + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body(grantBody) + .when() + .post("/GrantPermissions") + .then() + .statusCode(200); + + String revokeBody = "{" + + "\"Principal\":{\"DataLakePrincipalIdentifier\":\"arn:aws:iam::111122223333:role/my-role\"}," + + "\"Resource\":{\"Table\":{\"DatabaseName\":\"default\",\"Name\":\"my-table\"}}," + + "\"Permissions\":[\"INSERT\"]" + + "}"; + + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body(revokeBody) + .when() + .post("/RevokePermissions") + .then() + .statusCode(200); + + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{}") + .when() + .post("/ListPermissions") + .then() + .statusCode(200) + .body("PrincipalResourcePermissions[0].Permissions", contains("SELECT")); + } + + @Test + void grantAndListPermissionsTBAC() { + String grantBody = "{" + + "\"Principal\":{\"DataLakePrincipalIdentifier\":\"arn:aws:iam::111122223333:role/tbac\"}," + + "\"Resource\":{\"LFTag\":{\"CatalogId\":\"111122223333\",\"TagKey\":\"env\",\"TagValues\":[\"dev\"]}}," + + "\"Permissions\":[\"ASSOCIATE\"]" + + "}"; + + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body(grantBody) + .when() + .post("/GrantPermissions") + .then() + .statusCode(200); + + String listBody = "{" + + "\"Principal\":{\"DataLakePrincipalIdentifier\":\"arn:aws:iam::111122223333:role/tbac\"}" + + "}"; + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body(listBody) + .when() + .post("/ListPermissions") + .then() + .statusCode(200) + .body("PrincipalResourcePermissions[0].Resource.LFTag.TagKey", equalTo("env")) + .body("PrincipalResourcePermissions[0].Resource.LFTag.TagValues", contains("dev")) + .body("PrincipalResourcePermissions[0].Permissions", contains("ASSOCIATE")); + } + + @Test + void resourceLifecycle() { + String arn = "arn:aws:s3:::my-lake-bucket"; + String arn2 = "arn:aws:s3:::my-other-lake-bucket"; + + // Register first + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"ResourceArn\":\"" + arn + "\",\"RoleArn\":\"arn:aws:iam::111122223333:role/s3-role\",\"UseServiceLinkedRole\":true}") + .when() + .post("/RegisterResource") + .then() + .statusCode(200); + + // Register second + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"ResourceArn\":\"" + arn2 + "\",\"RoleArn\":\"arn:aws:iam::111122223333:role/s3-role\",\"UseServiceLinkedRole\":true}") + .when() + .post("/RegisterResource") + .then() + .statusCode(200); + + // Describe first + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"ResourceArn\":\"" + arn + "\"}") + .when() + .post("/DescribeResource") + .then() + .statusCode(200) + .body("ResourceInfo.ResourceArn", equalTo(arn)); + + // List with filter (should only return the first resource) + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"FilterConditionList\":[{\"Field\":\"RESOURCE_ARN\",\"ComparisonOperator\":\"EQ\",\"StringValueList\":[\"" + arn + "\"]}]}") + .when() + .post("/ListResources") + .then() + .statusCode(200) + .body("ResourceInfoList", hasSize(1)) + .body("ResourceInfoList[0].ResourceArn", equalTo(arn)); + + // Deregister + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"ResourceArn\":\"" + arn + "\"}") + .when() + .post("/DeregisterResource") + .then() + .statusCode(200); + + // Describe should fail now + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"ResourceArn\":\"" + arn + "\"}") + .when() + .post("/DescribeResource") + .then() + .statusCode(400) + .body("__type", equalTo("EntityNotFoundException")); + } + + @Test + void listAndDeleteLFTag() { + // Create tag + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"TagKey\":\"project\",\"TagValues\":[\"apollo\"]}") + .when() + .post("/CreateLFTag") + .then() + .statusCode(200); + + // List + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{}") + .when() + .post("/ListLFTags") + .then() + .statusCode(200) + .body("LFTags.TagKey", hasItem("project")); + + // Delete + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"TagKey\":\"project\"}") + .when() + .post("/DeleteLFTag") + .then() + .statusCode(200); + + // Get should fail + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"TagKey\":\"project\"}") + .when() + .post("/GetLFTag") + .then() + .statusCode(400) + .body("__type", equalTo("EntityNotFoundException")); + } + + @Test + void addAndRemoveLFTagsFromResource() { + String arn = "arn:aws:s3:::my-tagged-bucket"; + // Create tag + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"TagKey\":\"classification\",\"TagValues\":[\"confidential\"]}") + .when() + .post("/CreateLFTag") + .then() + .statusCode(200); + + // Add to resource + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"Resource\":{\"DataLocation\":{\"ResourceArn\":\"" + arn + "\"}},\"LFTags\":[{\"TagKey\":\"classification\",\"TagValues\":[\"confidential\"]}]}") + .when() + .post("/AddLFTagsToResource") + .then() + .statusCode(200); + + // Remove from resource + given() + .contentType(CONTENT_TYPE) + .header("Authorization", AUTH_HEADER) + .body("{\"Resource\":{\"DataLocation\":{\"ResourceArn\":\"" + arn + "\"}},\"LFTags\":[{\"TagKey\":\"classification\",\"TagValues\":[\"confidential\"]}]}") + .when() + .post("/RemoveLFTagsFromResource") + .then() + .statusCode(200); + } +} diff --git a/src/test/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationServiceTest.java new file mode 100644 index 0000000000..93f2ffb112 --- /dev/null +++ b/src/test/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationServiceTest.java @@ -0,0 +1,146 @@ +package io.github.hectorvent.floci.services.lakeformation; + +import io.github.hectorvent.floci.core.common.AwsException; +import io.github.hectorvent.floci.core.common.RegionResolver; +import io.github.hectorvent.floci.services.lakeformation.model.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +import java.util.List; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; + +class LakeFormationServiceTest { + + @Mock + private LakeFormationStorage storage; + + @Mock + private RegionResolver regionResolver; + + private LakeFormationService service; + + @BeforeEach + void setUp() { + MockitoAnnotations.openMocks(this); + when(regionResolver.getAccountId()).thenReturn("123456789012"); + service = new LakeFormationService(storage, regionResolver); + } + + @Test + void testPutDataLakeSettings() { + PutDataLakeSettingsRequest req = new PutDataLakeSettingsRequest(); + req.setCatalogId("custom-catalog"); + DataLakeSettings settings = new DataLakeSettings(); + req.setDataLakeSettings(settings); + + PutDataLakeSettingsResponse res = service.putDataLakeSettings("us-east-1", req); + + assertNotNull(res); + verify(storage).putDataLakeSettings("us-east-1", "custom-catalog", settings); + } + + @Test + void testRegisterResource() { + RegisterResourceRequest req = new RegisterResourceRequest(); + req.setResourceArn("arn:aws:s3:::my-bucket"); + req.setRoleArn("arn:aws:iam::123:role/MyRole"); + req.setUseServiceLinkedRole(true); + + when(storage.describeResource(anyString(), anyString())).thenReturn(Optional.empty()); + + RegisterResourceResponse res = service.registerResource("us-east-1", req); + + assertNotNull(res); + verify(storage).registerResource("us-east-1", "arn:aws:s3:::my-bucket", "arn:aws:iam::123:role/MyRole", true, null); + } + + @Test + void testRegisterResourceAlreadyExists() { + RegisterResourceRequest req = new RegisterResourceRequest(); + req.setResourceArn("arn:aws:s3:::my-bucket"); + + when(storage.describeResource("us-east-1", "arn:aws:s3:::my-bucket")).thenReturn(Optional.of(new ResourceInfo())); + + AwsException ex = assertThrows(AwsException.class, () -> service.registerResource("us-east-1", req)); + assertEquals("AlreadyExistsException", ex.getErrorCode()); + } + + @Test + void testRegisterResourceMissingArn() { + RegisterResourceRequest req = new RegisterResourceRequest(); + + AwsException ex = assertThrows(AwsException.class, () -> service.registerResource("us-east-1", req)); + assertEquals("InvalidInputException", ex.getErrorCode()); + } + + @Test + void testDescribeResource() { + DescribeResourceRequest req = new DescribeResourceRequest(); + req.setResourceArn("arn:aws:s3:::my-bucket"); + + ResourceInfo info = new ResourceInfo(); + info.setResourceArn("arn:aws:s3:::my-bucket"); + when(storage.describeResource("us-east-1", "arn:aws:s3:::my-bucket")).thenReturn(Optional.of(info)); + + DescribeResourceResponse res = service.describeResource("us-east-1", req); + assertNotNull(res.getResourceInfo()); + assertEquals("arn:aws:s3:::my-bucket", res.getResourceInfo().getResourceArn()); + } + + @Test + void testDescribeResourceNotFound() { + DescribeResourceRequest req = new DescribeResourceRequest(); + req.setResourceArn("arn:aws:s3:::my-bucket"); + when(storage.describeResource(anyString(), anyString())).thenReturn(Optional.empty()); + + AwsException ex = assertThrows(AwsException.class, () -> service.describeResource("us-east-1", req)); + assertEquals("EntityNotFoundException", ex.getErrorCode()); + } + + @Test + void testCreateLFTag() { + CreateLFTagRequest req = new CreateLFTagRequest(); + req.setTagKey("my-tag"); + req.setTagValues(List.of("val1", "val2")); + when(storage.getLFTag(anyString(), anyString(), anyString())).thenReturn(Optional.empty()); + + CreateLFTagResponse res = service.createLFTag("us-east-1", req); + assertNotNull(res); + + verify(storage).createLFTag("us-east-1", "123456789012", "my-tag", List.of("val1", "val2")); + } + + @Test + void testCreateLFTagAlreadyExists() { + CreateLFTagRequest req = new CreateLFTagRequest(); + req.setTagKey("my-tag"); + req.setTagValues(List.of("val1")); + + when(storage.getLFTag("us-east-1", "123456789012", "my-tag")).thenReturn(Optional.of(new LFTag())); + + AwsException ex = assertThrows(AwsException.class, () -> service.createLFTag("us-east-1", req)); + assertEquals("AlreadyExistsException", ex.getErrorCode()); + } + + @Test + void testGetLFTag() { + GetLFTagRequest req = new GetLFTagRequest(); + req.setTagKey("my-tag"); + + LFTag tag = new LFTag(); + tag.setTagKey("my-tag"); + tag.setTagValues(List.of("val1")); + when(storage.getLFTag("us-east-1", "123456789012", "my-tag")).thenReturn(Optional.of(tag)); + + GetLFTagResponse res = service.getLFTag("us-east-1", req); + assertEquals("123456789012", res.getCatalogId()); + assertEquals("my-tag", res.getTagKey()); + assertEquals(List.of("val1"), res.getTagValues()); + } +} diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 928c3bf589..45f78ebbe5 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -82,6 +82,8 @@ floci: flush-interval-ms: 60000 emrserverless: flush-interval-ms: 60000 + lakeformation: + flush-interval-ms: 60000 auth: validate-signatures: false @@ -339,6 +341,8 @@ floci: enabled: true emrserverless: enabled: true + lakeformation: + enabled: true tagging: enabled: true configservice: diff --git a/tools/docs/services.yaml b/tools/docs/services.yaml index 19eef28e61..6f38a046cc 100644 --- a/tools/docs/services.yaml +++ b/tools/docs/services.yaml @@ -162,6 +162,7 @@ deferred_handlers: - { path: src/main/java/io/github/hectorvent/floci/services/glue/GlueJsonHandler.java } # non-tabular doc (grouped/inline) - { path: src/main/java/io/github/hectorvent/floci/services/iam/IamQueryHandler.java } # non-tabular doc (grouped/inline) - { path: src/main/java/io/github/hectorvent/floci/services/iam/StsQueryHandler.java } # sts (lives in iam package); single-table, registerable next + - { path: src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationJsonHandler.java } # no standalone action table yet - { path: src/main/java/io/github/hectorvent/floci/services/lightsail/LightsailJsonHandler.java } # non-tabular doc (grouped/inline); standalone action table to be added - { path: src/main/java/io/github/hectorvent/floci/services/pricing/PricingJsonHandler.java } # no standalone action table yet - { path: src/main/java/io/github/hectorvent/floci/services/resourcegroupstagging/ResourceGroupsTaggingJsonHandler.java } # non-tabular doc (grouped/inline)