Skip to content

merge #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aws_lambda_powertools/utilities/parameters/appconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AppConfigProvider(BaseProvider):
-------
**Retrieves the latest configuration value from App Config**

>>> from aws_lambda_powertools.utilities.parameters import AppConfigProvider
>>> from aws_lambda_powertools.utilities import parameters
>>> appconf_provider = parameters.AppConfigProvider(environment="my_env", application="my_app")
>>>
>>> value : bytes = appconf_provider.get("my_conf")
Expand All @@ -43,7 +43,7 @@ class AppConfigProvider(BaseProvider):
**Retrieves a configuration value from App Config in another AWS region**

>>> from botocore.config import Config
>>> from aws_lambda_powertools.utilities.parameters import AppConfigProvider
>>> from aws_lambda_powertools.utilities import parameters
>>>
>>> config = Config(region_name="us-west-1")
>>> appconf_provider = parameters.AppConfigProvider(environment="my_env", application="my_app", config=config)
Expand Down
3 changes: 2 additions & 1 deletion aws_lambda_powertools/utilities/parser/models/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from typing import Any, Dict, List, Optional

from pydantic import BaseModel
from typing_extensions import Literal

from ..types import Literal


class DynamoDBStreamChangedRecordModel(BaseModel):
Expand Down
3 changes: 2 additions & 1 deletion aws_lambda_powertools/utilities/parser/models/kinesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

from pydantic import BaseModel, validator
from pydantic.types import PositiveInt
from typing_extensions import Literal

from ..types import Literal

logger = logging.getLogger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion aws_lambda_powertools/utilities/parser/models/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from pydantic.fields import Field
from pydantic.networks import IPvAnyNetwork
from pydantic.types import PositiveInt
from typing_extensions import Literal

from ..types import Literal


class S3EventRecordGlacierRestoreEventData(BaseModel):
Expand Down
3 changes: 2 additions & 1 deletion aws_lambda_powertools/utilities/parser/models/ses.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from pydantic import BaseModel, Field
from pydantic.networks import EmailStr
from pydantic.types import PositiveInt
from typing_extensions import Literal

from ..types import Literal


class SesReceiptVerdict(BaseModel):
Expand Down
3 changes: 2 additions & 1 deletion aws_lambda_powertools/utilities/parser/models/sns.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

from pydantic import BaseModel, root_validator
from pydantic.networks import HttpUrl
from typing_extensions import Literal

from ..types import Literal


class SnsMsgAttributeModel(BaseModel):
Expand Down
3 changes: 2 additions & 1 deletion aws_lambda_powertools/utilities/parser/models/sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from typing import Dict, List, Optional

from pydantic import BaseModel
from typing_extensions import Literal

from ..types import Literal


class SqsAttributesModel(BaseModel):
Expand Down
10 changes: 10 additions & 0 deletions aws_lambda_powertools/utilities/parser/types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
"""Generics and other shared types used across parser"""
import sys
from typing import TypeVar

from pydantic import BaseModel

# Workaround for not importing typing_extensions on python ^3.8
if sys.version_info[0] > 3 or (sys.version_info[0] == 3 and sys.version_info[1] >= 8):
from typing import Literal # noqa: F401
else:
try:
from typing_extensions import Literal # noqa: F401
except ImportError:
raise Exception("please install typing-extensions or upgrade to Python >= 3.8")

Model = TypeVar("Model", bound=BaseModel)
2 changes: 1 addition & 1 deletion docs/content/utilities/parser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ Envelope name | Behaviour | Return
**SqsEnvelope** | 1. Parses data using `SqsModel`. <br/> 2. Parses records in `body` key using your model and return them in a list. | `List[Model]`
**CloudWatchLogsEnvelope** | 1. Parses data using `CloudwatchLogsModel` which will base64 decode and decompress it. <br/> 2. Parses records in `message` key using your model and return them in a list. | `List[Model]`
**KinesisDataStreamEnvelope** | 1. Parses data using `KinesisDataStreamModel` which will base64 decode it. <br/> 2. Parses records in in `Records` key using your model and returns them in a list. | `List[Model]`
**SnsEnvelope** | 1. Parses data using `SqsModel`. <br/> 2. Parses records in `body` key using your model and return them in a list. | `List[Model]`
**SnsEnvelope** | 1. Parses data using `SnsModel`. <br/> 2. Parses records in `body` key using your model and return them in a list. | `List[Model]`
**SnsSqsEnvelope** | 1. Parses data using `SqsModel`. <br/> 2. Parses SNS records in `body` key using `SnsNotificationModel`. <br/> 3. Parses data in `Message` key using your model and return them in a list. | `List[Model]`

### bringing your own envelope
Expand Down
9 changes: 5 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"build": "gatsby build --prefix-paths"
},
"dependencies": {
"@aws-amplify/analytics": "^3.3.6",
"@aws-amplify/analytics": "^4.0.6",
"antd": "^4.7.0",
"aws-amplify": "^3.3.3",
"gatsby": "^2.24.77",
"aws-amplify": "^3.3.15",
"gatsby": "^2.4.0",
"gatsby-plugin-antd": "^2.2.0",
"gatsby-plugin-catch-links": "^2.3.15",
"gatsby-plugin-sitemap": "^2.4.16",
Expand All @@ -21,7 +21,8 @@
"bl": "^4.0.3",
"semver": "^7.3.2",
"node-fetch": "^2.6.1",
"axios": "^0.21.1"
"axios": "^0.21.1",
"socket.io": "^2.4.0"
},
"keywords": [],
"license": "MIT-0",
Expand Down
Loading