feat(apigateway): persist API key tags and add GetApiKey route#1677
Open
awuzi wants to merge 2 commits into
Open
feat(apigateway): persist API key tags and add GetApiKey route#1677awuzi wants to merge 2 commits into
awuzi wants to merge 2 commits into
Conversation
CreateApiKey now stores the request tags and returns them from CreateApiKey, GetApiKey and GetApiKeys. Adds the missing GET /apikeys/{apiKeyId} route, which omits the value unless includeValue=true and returns 404 when the key is unknown.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR closes API Gateway API key compatibility gaps by persisting tags on CreateApiKey and adding the missing GetApiKey route (GET /apikeys/{apiKeyId}), aiming to match AWS REST-JSON behavior and SDK expectations.
Changes:
- Add
tagsto theApiKeymodel and persist them duringCreateApiKey. - Add
GET /apikeys/{apiKeyId}withincludeValuesupport (omitvalueunless requested). - Add integration coverage for tag persistence, retrieval, listing, and not-found behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayApiKeyIntegrationTest.java | Adds integration tests for tag persistence and the new GetApiKey route. |
| src/main/java/io/github/hectorvent/floci/services/apigateway/model/ApiKey.java | Extends the API key model with a tags map and null-safe setter. |
| src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayService.java | Reads tags from the create request and persists them with the API key. |
| src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayController.java | Adds GET /apikeys/{apiKeyId} and serializes tags in API key JSON responses. |
Address review feedback: toApiKeyNode always emits "tags" (AWS returns "tags": {} even when empty); createApiKey coerces tag keys/values to String instead of an unchecked cast; the integration test initialises the shared apiKeyId to a sentinel and asserts the JSON error body on the 404 path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the two API Gateway API-key gaps reported in #1676:
CreateApiKeynow persists the requesttagsand returns them fromCreateApiKey,GetApiKeyandGetApiKeys.GetApiKeyroute (GET /apikeys/{apiKeyId}), delegating to the existingservice.getApiKey(...). It omitsvalueunlessincludeValue=true, and returns a JSONNotFoundException(404) for unknown keys.Changes
model/ApiKey.java— add atagsmap (mirrorsRestApi).ApiGatewayService#createApiKey— readtagsfrom the request (same pattern ascreateRestApi).ApiGatewayController— serializetagsintoApiKeyNode; add theGET /apikeys/{apiKeyId}route.ApiGatewayApiKeyIntegrationTest— covers tag persistence, GetApiKey (with/withoutvalue), listing, and 404.Notes
Backward-compatible: keys persisted before this change deserialize with an empty
tagsmap (@JsonIgnoreProperties(ignoreUnknown = true)+ default field value).Closes #1676