forked from aws-powertools/powertools-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudformation_custom_resource.py
31 lines (21 loc) · 1.41 KB
/
cloudformation_custom_resource.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from typing import Any, Dict, Union
from pydantic import BaseModel, Field, HttpUrl
from aws_lambda_powertools.utilities.parser.types import Literal
class CloudFormationCustomResourceBaseModel(BaseModel):
request_type: str = Field(..., alias="RequestType")
service_token: str = Field(..., alias="ServiceToken")
response_url: HttpUrl = Field(..., alias="ResponseURL")
stack_id: str = Field(..., alias="StackId")
request_id: str = Field(..., alias="RequestId")
logical_resource_id: str = Field(..., alias="LogicalResourceId")
resource_type: str = Field(..., alias="ResourceType")
resource_properties: Union[Dict[str, Any], BaseModel, None] = Field(None, alias="ResourceProperties")
class CloudFormationCustomResourceCreateModel(CloudFormationCustomResourceBaseModel):
request_type: Literal["Create"] = Field(..., alias="RequestType")
class CloudFormationCustomResourceDeleteModel(CloudFormationCustomResourceBaseModel):
request_type: Literal["Delete"] = Field(..., alias="RequestType")
physical_resource_id: str = Field(..., alias="PhysicalResourceId")
class CloudFormationCustomResourceUpdateModel(CloudFormationCustomResourceBaseModel):
request_type: Literal["Update"] = Field(..., alias="RequestType")
physical_resource_id: str = Field(..., alias="PhysicalResourceId")
old_resource_properties: Union[Dict[str, Any], BaseModel, None] = Field(None, alias="OldResourceProperties")