File tree 1 file changed +3
-9
lines changed
aws_lambda_powertools/utilities/data_classes
1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -28,24 +28,18 @@ def __init__(
28
28
self .api_id = api_id
29
29
self .stage = stage
30
30
self .http_method = http_method
31
- self .resource = resource
31
+ # Remove matching "/" from `resource`.
32
+ self .resource = resource .lstrip ("/" )
32
33
33
34
@property
34
35
def arn (self ) -> str :
35
36
"""Build an arn from its parts
36
37
eg: arn:aws:execute-api:us-east-1:123456789012:abcdef123/test/GET/request"""
37
38
return (
38
39
f"arn:{ self .partition } :execute-api:{ self .region } :{ self .aws_account_id } :{ self .api_id } /{ self .stage } /"
39
- f"{ self .http_method } /{ self ._resource } "
40
+ f"{ self .http_method } /{ self .resource } "
40
41
)
41
42
42
- @property
43
- def _resource (self ) -> str :
44
- """Remove matching "/" from `resource`. To be replaced with built-in `removeprefix`"""
45
- if self .resource .startswith ("/" ):
46
- return self .resource [1 :]
47
- return self .resource
48
-
49
43
50
44
def parse_api_gateway_arn (arn : str ) -> APIGatewayRouteArn :
51
45
"""Parses a gateway route arn as a APIGatewayRouteArn class
You can’t perform that action at this time.
0 commit comments