PHANTOM
🇮🇳 IN
Skip to content

APIGW: add CRUD support for Stage.AccessLogSettings#13849

Open
bentsku wants to merge 3 commits intomainfrom
apigw-crud-stage-access-log
Open

APIGW: add CRUD support for Stage.AccessLogSettings#13849
bentsku wants to merge 3 commits intomainfrom
apigw-crud-stage-access-log

Conversation

@bentsku
Copy link
Contributor

@bentsku bentsku commented Feb 25, 2026

Motivation

We got a request to add CRUD support for AccessLogSettings in APIGW. This PR adds support for UpdateStage and for the AccessLogSettings in CFN

See https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html

Funny enough, you cannot specify that in CreateStage, it has to go through update.

This PR does not add support for properly sending the logs to CloudWatch or Firehose.

Changes

  • add support and validation for AccessLogSettings, there was partial support in Moto so it only needed a bit of validation and adaptation to what we send to it
  • update the AWS::ApiGateway::Stage resource to properly update the Stage with the values
  • add AWS validated tests for SDK calls and CFN

Tests

Related

@bentsku bentsku added this to the 2026.03 milestone Feb 25, 2026
@bentsku bentsku self-assigned this Feb 25, 2026
@bentsku bentsku added aws:apigateway Amazon API Gateway semver: patch Non-breaking changes which can be included in patch releases docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes labels Feb 25, 2026
@github-actions
Copy link

Test Results - Preflight, Unit

23 070 tests  ±0   21 179 ✅ ±0   6m 21s ⏱️ -1s
     1 suites ±0    1 891 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 3f5b7e2. ± Comparison against base commit bcfefa6.

@github-actions
Copy link

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 3s ⏱️ ±0s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 3f5b7e2. ± Comparison against base commit bcfefa6.

@github-actions
Copy link

Test Results - Alternative Providers

573 tests   312 ✅  17m 45s ⏱️
  1 suites  261 💤
  1 files      0 ❌

Results for commit 3f5b7e2.

@github-actions
Copy link

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   2h 41m 40s ⏱️
5 743 tests 5 216 ✅ 527 💤 0 ❌
5 749 runs  5 216 ✅ 533 💤 0 ❌

Results for commit 3f5b7e2.

@github-actions
Copy link

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   2h 4m 54s ⏱️ -38s
5 338 tests +3  4 967 ✅ +3  371 💤 ±0  0 ❌ ±0 
5 340 runs  +3  4 967 ✅ +3  373 💤 ±0  0 ❌ ±0 

Results for commit 3f5b7e2. ± Comparison against base commit bcfefa6.

@bentsku bentsku marked this pull request as ready for review February 26, 2026 09:45
Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only reviewed the CFn changes, but they seem sound. Thanks!


# TODO: add methodSettings with the same principle
patch_operations = []
if access_log_settings := model.get("AccessLogSetting"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a horrible API!

Copy link
Member

@cloutierMat cloutierMat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding support for the access log settings. Hopefully, we get time to add integration with CW 🙏

Really nice and thorough testing of the update method and kudos on thinking ahead and ensuring CFN support! 🚀

Comment on lines +490 to +499
# See https://docs.aws.amazon.com/apigateway/latest/api/patch-operations.html#UpdateStage-Patch
# not everything is right on the table, for example no path supports `remove` accept the root path
# TODO: validate destinationArn is a valid ARN (does not have to validate it exists)
valid_paths = ["/accessLogSettings/destinationArn", "/accessLogSettings/format"]
if op == "remove":
if path != "/accessLogSettings":
stripped_path = path.removeprefix("/")
raise BadRequestException(
f"Cannot remove method setting {stripped_path} because there is no method setting for this method "
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞


class TestApiGatewayStage:
@pytest.fixture
def create_api_for_deployment(self, apigw_create_rest_api, aws_client):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for creating this small fixture! makes reading the test much easier! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aws:apigateway Amazon API Gateway docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes semver: patch Non-breaking changes which can be included in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants