Skip to content

Commit 840c859

Browse files
Merge branch 'develop' into ci/add-docs-build-workflow
2 parents d829d13 + 69b1eab commit 840c859

File tree

17 files changed

+155
-40
lines changed

17 files changed

+155
-40
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@
44
<a name="unreleased"></a>
55
# Unreleased
66

7+
## Features
8+
9+
* **typing:** add tenant_id property ([#6985](https://github.com/aws-powertools/powertools-lambda-python/issues/6985))
10+
711
## Maintenance
812

13+
* **ci:** new pre-release 3.17.1a0 ([#6989](https://github.com/aws-powertools/powertools-lambda-python/issues/6989))
14+
* **ci:** new pre-release 3.17.1a1 ([#6997](https://github.com/aws-powertools/powertools-lambda-python/issues/6997))
15+
* **deps-dev:** bump aws-cdk from 2.1020.2 to 2.1021.0 ([#6992](https://github.com/aws-powertools/powertools-lambda-python/issues/6992))
16+
* **deps-dev:** bump boto3-stubs from 1.39.4 to 1.39.7 ([#6994](https://github.com/aws-powertools/powertools-lambda-python/issues/6994))
17+
* **deps-dev:** bump sentry-sdk from 2.32.0 to 2.33.0 ([#6988](https://github.com/aws-powertools/powertools-lambda-python/issues/6988))
18+
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.204.0a0 to 2.205.0a0 ([#6986](https://github.com/aws-powertools/powertools-lambda-python/issues/6986))
19+
* **deps-dev:** bump aws-cdk-lib from 2.205.0 to 2.206.0 ([#6996](https://github.com/aws-powertools/powertools-lambda-python/issues/6996))
20+
* **deps-dev:** bump pytest-asyncio from 0.26.0 to 1.1.0 ([#6995](https://github.com/aws-powertools/powertools-lambda-python/issues/6995))
21+
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.205.0a0 to 2.206.0a0 ([#6993](https://github.com/aws-powertools/powertools-lambda-python/issues/6993))
922

1023

1124
<a name="v3.17.0"></a>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Exposes version constant to avoid circular dependencies."""
22

3-
VERSION = "3.17.0"
3+
VERSION = "3.17.1a1"

aws_lambda_powertools/utilities/parser/models/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@
2727
RequestContextV2AuthorizerJwt,
2828
RequestContextV2Http,
2929
)
30-
from .appsync import (
31-
AppSyncResolverEventModel,
32-
)
30+
from .appsync import AppSyncResolverEventModel
31+
from .appsync_events import AppSyncEventsModel
3332
from .bedrock_agent import (
3433
BedrockAgentEventModel,
3534
BedrockAgentFunctionEventModel,
@@ -170,6 +169,7 @@
170169
"AlbRequestContext",
171170
"AlbRequestContextData",
172171
"AppSyncResolverEventModel",
172+
"AppSyncEventsModel",
173173
"DynamoDBStreamModel",
174174
"EventBridgeModel",
175175
"DynamoDBStreamChangedRecordModel",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from typing import Any, Dict, List, Literal, Optional
2+
3+
from pydantic import BaseModel
4+
5+
from aws_lambda_powertools.utilities.parser.models.appsync import AppSyncIdentity, AppSyncRequestModel
6+
7+
8+
class AppSyncEventsInfoChannelModel(BaseModel):
9+
path: str
10+
segments: List[str]
11+
12+
13+
class AppSyncEventsInfoChannelNamespaceModel(BaseModel):
14+
name: str
15+
16+
17+
class AppSyncEventsInfoModel(BaseModel):
18+
channel: AppSyncEventsInfoChannelModel
19+
channelNamespace: AppSyncEventsInfoChannelNamespaceModel
20+
operation: Literal["PUBLISH", "SUBSCRIBE"]
21+
22+
23+
class AppSyncEventsEventModel(BaseModel):
24+
id: str
25+
payload: Dict[str, Any]
26+
27+
28+
class AppSyncEventsModel(BaseModel):
29+
identity: Optional[AppSyncIdentity] = None
30+
request: AppSyncRequestModel
31+
info: AppSyncEventsInfoModel
32+
prev: Optional[str] = None
33+
outErrors: Optional[List[str]] = None
34+
stash: Optional[Dict[str, Any]] = None
35+
events: Optional[List[AppSyncEventsEventModel]] = None

aws_lambda_powertools/utilities/typing/lambda_context.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class LambdaContext:
3434
_aws_request_id: str
3535
_log_group_name: str
3636
_log_stream_name: str
37+
_tenant_id: str | None = None
3738
_identity: LambdaCognitoIdentity
3839
_client_context: LambdaClientContext
3940

@@ -75,14 +76,19 @@ def log_stream_name(self) -> str:
7576

7677
@property
7778
def identity(self) -> LambdaCognitoIdentity:
78-
"""(mobile apps) Information about the Amazon Cognito identity that authorized the request."""
79+
"""Information about the Amazon Cognito identity that authorized the request."""
7980
return self._identity
8081

8182
@property
8283
def client_context(self) -> LambdaClientContext:
83-
"""(mobile apps) Client context that's provided to Lambda by the client application."""
84+
"""Client context that's provided to Lambda by the client application."""
8485
return self._client_context
8586

87+
@property
88+
def tenant_id(self) -> str | None:
89+
"""The tenant_id"""
90+
return self._tenant_id
91+
8692
@staticmethod
8793
def get_remaining_time_in_millis() -> int:
8894
"""Returns the number of milliseconds left before the execution times out."""

docs/core/event_handler/api_gateway.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Event handler for Amazon API Gateway REST and HTTP APIs, Application Load Balanc
1111
* Support for CORS, binary and Gzip compression, Decimals JSON encoding and bring your own JSON serializer
1212
* Built-in integration with [Event Source Data Classes utilities](../../utilities/data_classes.md){target="_blank"} for self-documented event schema
1313
* Works with micro function (one or a few routes) and monolithic functions (all routes)
14-
* Support for OpenAPI and data validation for requests/responses
14+
* Support for OpenAPI schema generation
15+
* Support data validation for requests/responses
1516

1617
## Getting started
1718

@@ -430,7 +431,7 @@ This value will override the value of the failed response validation http code s
430431

431432
#### Validating query strings
432433

433-
!!! info "We will automatically validate and inject incoming query strings via type annotation."
434+
!!! info "You must set `enable_validation=True` to have access to the incoming query strings parameters via type annotation."
434435

435436
We use the `Annotated` type to tell the Event Handler that a particular parameter is not only an optional string, but also a query string with constraints.
436437

@@ -490,9 +491,9 @@ For example, we could validate that `<todo_id>` dynamic path should be no greate
490491

491492
#### Validating headers
492493

493-
We use the `Annotated` type to tell the Event Handler that a particular parameter is a header that needs to be validated.
494+
!!! info "You must set `enable_validation=True` to have access to the incoming headers parameters via type annotation."
494495

495-
!!! info "We adhere to [HTTP RFC standards](https://www.rfc-editor.org/rfc/rfc7540#section-8.1.2){target="_blank" rel="nofollow"}, which means we treat HTTP headers as case-insensitive."
496+
We use the `Annotated` type to tell the Event Handler that a particular parameter is a header that needs to be validated. Also, we adhere to [HTTP RFC standards](https://www.rfc-editor.org/rfc/rfc7540#section-8.1.2){target="_blank" rel="nofollow"}, which means we treat HTTP headers as case-insensitive.
496497

497498
In the following example, we use a new `Header` OpenAPI type to add [one out of many possible constraints](#customizing-openapi-parameters), which should read as:
498499

docs/utilities/parser.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ The example above uses `SqsModel`. Other built-in models can be found below.
112112
| **APIGatewayWebSocketConnectEventModel** | Lambda Event Source payload for Amazon API Gateway WebSocket API $connect message |
113113
| **APIGatewayWebSocketDisconnectEventModel** | Lambda Event Source payload for Amazon API Gateway WebSocket API $disconnect message |
114114
| **AppSyncResolverEventModel** | Lambda Event Source payload for AWS AppSync Resolver |
115+
| **AppSyncEventsModel** | Lambda Event Source payload for AWS AppSync Events |
115116
| **BedrockAgentEventModel** | Lambda Event Source payload for Bedrock Agents - OpenAPI-based |
116117
| **BedrockAgentFunctionEventModel** | Lambda Event Source payload for Bedrock Agents - Function-based |
117118
| **CloudFormationCustomResourceCreateModel** | Lambda Event Source payload for AWS CloudFormation `CREATE` operation |

docs/utilities/typing.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,18 @@ Using `LambdaContext` typing makes it possible to access information and hints o
4242
--8<-- "examples/typing/src/working_with_context_function.py"
4343
```
4444

45-
![Utilities Typing All](../media/utilities_typing_2.png)
46-
![Utilities Typing Specific](../media/utilities_typing_3.png)
45+
### Available properties and methods
46+
47+
| Name | Type | Description |
48+
| ------------------------------ | -------- | ------------------------------------------------------------------------- |
49+
| `function_name` | property | The name of the Lambda function |
50+
| `function_version` | property | The version of the function |
51+
| `invoked_function_arn` | property | The Amazon Resource Name (ARN) that's used to invoke the function |
52+
| `memory_limit_in_mb` | property | The amount of memory that's allocated for the function |
53+
| `aws_request_id` | property | The identifier of the invocation request |
54+
| `log_group_name` | property | The log group for the function |
55+
| `log_stream_name` | property | The log stream for the function instance |
56+
| `identity` | property | Information about the Amazon Cognito identity that authorized the request |
57+
| `client_context` | property | Client context that's provided to Lambda by the client application |
58+
| `tenant_id` | property | The tenant_id used to invoke the function |
59+
| `get_remaining_time_in_millis` | method | Returns the number of milliseconds left before the execution times out |

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "aws-lambda-powertools-python-e2e",
33
"version": "1.0.0",
44
"devDependencies": {
5-
"aws-cdk": "^2.1020.2"
5+
"aws-cdk": "^2.1021.0"
66
}
77
}

0 commit comments

Comments
 (0)