moto 4.2.8.dev2__py2.py3-none-any.whl → 4.2.8.dev3__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- moto/__init__.py +1 -1
- moto/signer/models.py +27 -12
- moto/signer/responses.py +32 -1
- moto/signer/urls.py +7 -6
- {moto-4.2.8.dev2.dist-info → moto-4.2.8.dev3.dist-info}/METADATA +1 -1
- {moto-4.2.8.dev2.dist-info → moto-4.2.8.dev3.dist-info}/RECORD +11 -11
- {moto-4.2.8.dev2.dist-info → moto-4.2.8.dev3.dist-info}/AUTHORS.md +0 -0
- {moto-4.2.8.dev2.dist-info → moto-4.2.8.dev3.dist-info}/LICENSE +0 -0
- {moto-4.2.8.dev2.dist-info → moto-4.2.8.dev3.dist-info}/WHEEL +0 -0
- {moto-4.2.8.dev2.dist-info → moto-4.2.8.dev3.dist-info}/entry_points.txt +0 -0
- {moto-4.2.8.dev2.dist-info → moto-4.2.8.dev3.dist-info}/top_level.txt +0 -0
moto/__init__.py
CHANGED
moto/signer/models.py
CHANGED
|
@@ -2,17 +2,17 @@ from typing import Any, Dict, List, Optional
|
|
|
2
2
|
|
|
3
3
|
from moto.core import BaseBackend, BackendDict, BaseModel
|
|
4
4
|
from moto.moto_api._internal import mock_random
|
|
5
|
+
from moto.utilities.tagging_service import TaggingService
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class SigningProfile(BaseModel):
|
|
8
9
|
def __init__(
|
|
9
10
|
self,
|
|
10
|
-
|
|
11
|
-
region: str,
|
|
11
|
+
backend: "SignerBackend",
|
|
12
12
|
name: str,
|
|
13
13
|
platform_id: str,
|
|
14
|
+
signing_material: Dict[str, str],
|
|
14
15
|
signature_validity_period: Optional[Dict[str, Any]],
|
|
15
|
-
tags: Dict[str, str],
|
|
16
16
|
):
|
|
17
17
|
self.name = name
|
|
18
18
|
self.platform_id = platform_id
|
|
@@ -20,12 +20,13 @@ class SigningProfile(BaseModel):
|
|
|
20
20
|
"value": 135,
|
|
21
21
|
"type": "MONTHS",
|
|
22
22
|
}
|
|
23
|
-
self.
|
|
23
|
+
self.backend = backend
|
|
24
24
|
|
|
25
25
|
self.status = "Active"
|
|
26
|
-
self.arn = f"arn:aws:signer:{
|
|
26
|
+
self.arn = f"arn:aws:signer:{backend.region_name}:{backend.account_id}:/signing-profiles/{name}"
|
|
27
27
|
self.profile_version = mock_random.get_random_hex(10)
|
|
28
28
|
self.profile_version_arn = f"{self.arn}/{self.profile_version}"
|
|
29
|
+
self.signing_material = signing_material
|
|
29
30
|
|
|
30
31
|
def cancel(self) -> None:
|
|
31
32
|
self.status = "Canceled"
|
|
@@ -43,7 +44,7 @@ class SigningProfile(BaseModel):
|
|
|
43
44
|
"profileName": self.name,
|
|
44
45
|
"platformId": self.platform_id,
|
|
45
46
|
"signatureValidityPeriod": self.signature_validity_period,
|
|
46
|
-
"signingMaterial":
|
|
47
|
+
"signingMaterial": self.signing_material,
|
|
47
48
|
"platformDisplayName": next(
|
|
48
49
|
(
|
|
49
50
|
p["displayName"]
|
|
@@ -54,8 +55,9 @@ class SigningProfile(BaseModel):
|
|
|
54
55
|
),
|
|
55
56
|
}
|
|
56
57
|
)
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
tags = self.backend.list_tags_for_resource(self.arn)
|
|
59
|
+
if tags:
|
|
60
|
+
small.update({"tags": tags})
|
|
59
61
|
return small
|
|
60
62
|
|
|
61
63
|
|
|
@@ -160,6 +162,7 @@ class SignerBackend(BaseBackend):
|
|
|
160
162
|
def __init__(self, region_name: str, account_id: str):
|
|
161
163
|
super().__init__(region_name, account_id)
|
|
162
164
|
self.signing_profiles: Dict[str, SigningProfile] = dict()
|
|
165
|
+
self.tagger = TaggingService()
|
|
163
166
|
|
|
164
167
|
def cancel_signing_profile(self, profile_name: str) -> None:
|
|
165
168
|
self.signing_profiles[profile_name].cancel()
|
|
@@ -172,20 +175,21 @@ class SignerBackend(BaseBackend):
|
|
|
172
175
|
profile_name: str,
|
|
173
176
|
signature_validity_period: Optional[Dict[str, Any]],
|
|
174
177
|
platform_id: str,
|
|
178
|
+
signing_material: Dict[str, str],
|
|
175
179
|
tags: Dict[str, str],
|
|
176
180
|
) -> SigningProfile:
|
|
177
181
|
"""
|
|
178
|
-
The following parameters are not yet implemented:
|
|
182
|
+
The following parameters are not yet implemented: Overrides, SigningParameters
|
|
179
183
|
"""
|
|
180
184
|
profile = SigningProfile(
|
|
181
|
-
|
|
182
|
-
region=self.region_name,
|
|
185
|
+
backend=self,
|
|
183
186
|
name=profile_name,
|
|
184
187
|
platform_id=platform_id,
|
|
188
|
+
signing_material=signing_material,
|
|
185
189
|
signature_validity_period=signature_validity_period,
|
|
186
|
-
tags=tags,
|
|
187
190
|
)
|
|
188
191
|
self.signing_profiles[profile_name] = profile
|
|
192
|
+
self.tag_resource(profile.arn, tags)
|
|
189
193
|
return profile
|
|
190
194
|
|
|
191
195
|
def list_signing_platforms(self) -> List[Dict[str, Any]]:
|
|
@@ -194,6 +198,17 @@ class SignerBackend(BaseBackend):
|
|
|
194
198
|
"""
|
|
195
199
|
return SignerBackend.platforms
|
|
196
200
|
|
|
201
|
+
def list_tags_for_resource(self, resource_arn: str) -> Dict[str, str]:
|
|
202
|
+
return self.tagger.get_tag_dict_for_resource(resource_arn)
|
|
203
|
+
|
|
204
|
+
def tag_resource(self, resource_arn: str, tags: Dict[str, str]) -> None:
|
|
205
|
+
self.tagger.tag_resource(
|
|
206
|
+
resource_arn, TaggingService.convert_dict_to_tags_input(tags)
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
def untag_resource(self, resource_arn: str, tag_keys: List[str]) -> None:
|
|
210
|
+
self.tagger.untag_resource_using_names(resource_arn, tag_keys)
|
|
211
|
+
|
|
197
212
|
|
|
198
213
|
# Using the lambda-regions
|
|
199
214
|
# boto3.Session().get_available_regions("signer") still returns an empty list
|
moto/signer/responses.py
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"""Handles incoming signer requests, invokes methods, returns responses."""
|
|
2
2
|
import json
|
|
3
|
+
from typing import Any
|
|
4
|
+
from urllib.parse import unquote
|
|
3
5
|
|
|
4
6
|
from moto.core.responses import BaseResponse
|
|
5
7
|
from .models import signer_backends, SignerBackend
|
|
6
8
|
|
|
7
9
|
|
|
8
|
-
class
|
|
10
|
+
class SignerResponse(BaseResponse):
|
|
9
11
|
def __init__(self) -> None:
|
|
10
12
|
super().__init__(service_name="signer")
|
|
11
13
|
|
|
@@ -30,10 +32,12 @@ class signerResponse(BaseResponse):
|
|
|
30
32
|
signature_validity_period = params.get("signatureValidityPeriod")
|
|
31
33
|
platform_id = params.get("platformId")
|
|
32
34
|
tags = params.get("tags")
|
|
35
|
+
signing_material = params.get("signingMaterial")
|
|
33
36
|
profile = self.signer_backend.put_signing_profile(
|
|
34
37
|
profile_name=profile_name,
|
|
35
38
|
signature_validity_period=signature_validity_period,
|
|
36
39
|
platform_id=platform_id,
|
|
40
|
+
signing_material=signing_material,
|
|
37
41
|
tags=tags,
|
|
38
42
|
)
|
|
39
43
|
return json.dumps(profile.to_dict(full=False))
|
|
@@ -41,3 +45,30 @@ class signerResponse(BaseResponse):
|
|
|
41
45
|
def list_signing_platforms(self) -> str:
|
|
42
46
|
platforms = self.signer_backend.list_signing_platforms()
|
|
43
47
|
return json.dumps(dict(platforms=platforms))
|
|
48
|
+
|
|
49
|
+
def list_tags_for_resource(self) -> str:
|
|
50
|
+
resource_arn = unquote(self.path.split("/tags/")[-1])
|
|
51
|
+
return json.dumps(
|
|
52
|
+
{"tags": self.signer_backend.list_tags_for_resource(resource_arn)}
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def tag_resource(self) -> str:
|
|
56
|
+
resource_arn = unquote(self.path.split("/tags/")[-1])
|
|
57
|
+
tags = self._get_param("tags")
|
|
58
|
+
self.signer_backend.tag_resource(resource_arn, tags)
|
|
59
|
+
return "{}"
|
|
60
|
+
|
|
61
|
+
def untag_resource(self) -> str:
|
|
62
|
+
resource_arn = unquote(self.path.split("/tags/")[-1])
|
|
63
|
+
tag_keys = self.querystring.get("tagKeys")
|
|
64
|
+
self.signer_backend.untag_resource(resource_arn, tag_keys) # type: ignore
|
|
65
|
+
return "{}"
|
|
66
|
+
|
|
67
|
+
def tags(self, request: Any, full_url: str, headers: Any) -> str: # type: ignore[return]
|
|
68
|
+
self.setup_class(request, full_url, headers)
|
|
69
|
+
if request.method == "GET":
|
|
70
|
+
return self.list_tags_for_resource()
|
|
71
|
+
if request.method == "POST":
|
|
72
|
+
return self.tag_resource()
|
|
73
|
+
if request.method == "DELETE":
|
|
74
|
+
return self.untag_resource()
|
moto/signer/urls.py
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"""signer base URL and path."""
|
|
2
|
-
from .responses import
|
|
2
|
+
from .responses import SignerResponse
|
|
3
3
|
|
|
4
4
|
url_bases = [
|
|
5
5
|
r"https?://signer\.(.+)\.amazonaws\.com",
|
|
6
6
|
]
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
response = signerResponse()
|
|
10
|
-
|
|
11
|
-
|
|
12
9
|
url_paths = {
|
|
13
|
-
"{0}/
|
|
14
|
-
"{0}/signing-
|
|
10
|
+
"{0}/tags/(?P<profile_arn>[^/]+)$": SignerResponse.dispatch,
|
|
11
|
+
"{0}/tags/(?P<arn_prefix>[^/]+)/signing-profiles/(?P<profile_name>[^/]+)$": SignerResponse.method_dispatch(
|
|
12
|
+
SignerResponse.tags # type: ignore
|
|
13
|
+
),
|
|
14
|
+
"{0}/signing-profiles/(?P<profile_name>[^/]+)$": SignerResponse.dispatch,
|
|
15
|
+
"{0}/signing-platforms$": SignerResponse.dispatch,
|
|
15
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
moto/__init__.py,sha256=
|
|
1
|
+
moto/__init__.py,sha256=AtsO80qdHP78QhPO-ffXJsE_5sY2FUvaGmgyKMYS0Iw,9736
|
|
2
2
|
moto/backend_index.py,sha256=LvyWuvNURVUzNmMxRpCbL8AOb2Gaux-k5y1d8Ht4qH8,10853
|
|
3
3
|
moto/backends.py,sha256=rC9WUMUUWmVmX7ZEfXpVKAQAw6oI8qYobCEPxP2Zv9U,1805
|
|
4
4
|
moto/proxy.py,sha256=G1eDJn7_VBPymkqMcREfMDforRDRYkEWI2-3H3MBvrc,3113
|
|
@@ -900,9 +900,9 @@ moto/sesv2/responses.py,sha256=HMEbHxTLyMVUsyB6xYicYAj1gbyNbmkLyW27Yi0w8Ys,4245
|
|
|
900
900
|
moto/sesv2/urls.py,sha256=7rQa-Zm1ItCdCHyXbirYLSwPwqqDW_hbQ8_eKXByMMY,569
|
|
901
901
|
moto/signer/__init__.py,sha256=ybpTQwvBIYd6UKDK0VuFwr0QnKcG3tvm4j8ciAJL_z0,191
|
|
902
902
|
moto/signer/exceptions.py,sha256=itpR-x9UvMREeBgujdENBVa2YMWM22_wDv9U87sBQMo,47
|
|
903
|
-
moto/signer/models.py,sha256=
|
|
904
|
-
moto/signer/responses.py,sha256=
|
|
905
|
-
moto/signer/urls.py,sha256=
|
|
903
|
+
moto/signer/models.py,sha256=NRLJX4UevMQdaEEZscWtk09I12dM9Ek1RmC_O3Xgwm8,7747
|
|
904
|
+
moto/signer/responses.py,sha256=70GmPa1FIoE4kV-RIrCoNBuvtbV2y8dtNBB1wcA4uSQ,2890
|
|
905
|
+
moto/signer/urls.py,sha256=cvMkrfFGQ6HWsSrJASFK1ai0zuLpgLgGJOYTy9nrFL0,512
|
|
906
906
|
moto/sns/__init__.py,sha256=CpOkt-MeQp-ZskG1wkpPLNrdyn_RbwsfMf0MURELycw,115
|
|
907
907
|
moto/sns/exceptions.py,sha256=71EJlm9xdg67v8ZSf7Cy1hMbCQDE7gNYB5Wj06Oa7Dg,2271
|
|
908
908
|
moto/sns/models.py,sha256=gqnvOCjJeFZ3WVhveSKgfgOA9DugHfdyR-JDVnahQ7M,43968
|
|
@@ -1054,10 +1054,10 @@ moto/xray/mock_client.py,sha256=nYl8JVJbl3OY-tnUafkVOG4K4-cFm5bsft3Hxo7fKwI,3809
|
|
|
1054
1054
|
moto/xray/models.py,sha256=0QL6nmhpVVwAiyi9aw4pBwVTRhqPW9oIy2uwPDhPKug,11179
|
|
1055
1055
|
moto/xray/responses.py,sha256=p2xsg2-P9h_1DCyuBC7GenmC5L64tXAX6a-XCb2j5-o,6316
|
|
1056
1056
|
moto/xray/urls.py,sha256=R6T3gMwobWipukWcC1DQ36CU1Rjt6oqBDoe-7HqaIZU,393
|
|
1057
|
-
moto-4.2.8.
|
|
1058
|
-
moto-4.2.8.
|
|
1059
|
-
moto-4.2.8.
|
|
1060
|
-
moto-4.2.8.
|
|
1061
|
-
moto-4.2.8.
|
|
1062
|
-
moto-4.2.8.
|
|
1063
|
-
moto-4.2.8.
|
|
1057
|
+
moto-4.2.8.dev3.dist-info/AUTHORS.md,sha256=dDUhasV8HGSkzb7zj7a0b3alnqY0P1LPOyOUNoo8Mpo,2976
|
|
1058
|
+
moto-4.2.8.dev3.dist-info/LICENSE,sha256=8S75_TlqE-kIeGMLG0-rRxxu2ct6SM8quyUWKBYyIY4,10834
|
|
1059
|
+
moto-4.2.8.dev3.dist-info/METADATA,sha256=nIg_3p1q7hjppvucLmP1bLFdVrTJuE7VUODBFVDl1Ok,12926
|
|
1060
|
+
moto-4.2.8.dev3.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
|
|
1061
|
+
moto-4.2.8.dev3.dist-info/entry_points.txt,sha256=QWCojULQb54Hi_2KamEEYHA6Cwek_vN685aS8DbI9rU,78
|
|
1062
|
+
moto-4.2.8.dev3.dist-info/top_level.txt,sha256=TETRKAPcAAvoZDkSkwQiZtTSr-1gzaEAXVm9FmZKj8s,5
|
|
1063
|
+
moto-4.2.8.dev3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|