moto 4.2.3.dev16__py2.py3-none-any.whl → 4.2.3.dev18__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 CHANGED
@@ -148,6 +148,7 @@ mock_resourcegroups = lazy_load(
148
148
  mock_resourcegroupstaggingapi = lazy_load(
149
149
  ".resourcegroupstaggingapi", "mock_resourcegroupstaggingapi"
150
150
  )
151
+ mock_robomaker = lazy_load(".robomaker", "mock_robomaker")
151
152
  mock_route53 = lazy_load(".route53", "mock_route53")
152
153
  mock_route53resolver = lazy_load(
153
154
  ".route53resolver", "mock_route53resolver", boto3_name="route53resolver"
@@ -211,7 +212,7 @@ mock_all = MockAll
211
212
  # logging.getLogger('boto').setLevel(logging.CRITICAL)
212
213
 
213
214
  __title__ = "moto"
214
- __version__ = "4.2.3.dev16"
215
+ __version__ = "4.2.3.dev18"
215
216
 
216
217
 
217
218
  try:
moto/backend_index.py CHANGED
@@ -136,6 +136,7 @@ backend_url_patterns = [
136
136
  re.compile("https?://resource-groups(-fips)?\\.(.+)\\.amazonaws.com"),
137
137
  ),
138
138
  ("resourcegroupstaggingapi", re.compile("https?://tagging\\.(.+)\\.amazonaws.com")),
139
+ ("robomaker", re.compile("https?://robomaker\\.(.+)\\.amazonaws\\.com")),
139
140
  ("route53", re.compile("https?://route53(\\..+)?\\.amazonaws.com")),
140
141
  (
141
142
  "route53resolver",
@@ -0,0 +1,5 @@
1
+ """robomaker module initialization; sets value for base decorator."""
2
+ from .models import robomaker_backends
3
+ from ..core.models import base_decorator
4
+
5
+ mock_robomaker = base_decorator(robomaker_backends)
@@ -0,0 +1,73 @@
1
+ from moto.core import BaseBackend, BackendDict, BaseModel
2
+ from moto.core.utils import unix_time
3
+
4
+ from typing import Any, Dict, List, Iterable
5
+
6
+
7
+ class RobotApplication(BaseModel):
8
+ def __init__(
9
+ self,
10
+ account_id: str,
11
+ region: str,
12
+ name: str,
13
+ sources: List[Dict[str, str]],
14
+ robot_software_suite: Dict[str, str],
15
+ ):
16
+ self.account_id = account_id
17
+ self.region = region
18
+ self.name = name
19
+ self.sources = sources
20
+ self.robot_software_suite = robot_software_suite
21
+ self.created_on = unix_time()
22
+
23
+ @property
24
+ def arn(self) -> str:
25
+ return f"arn:aws:robomaker:{self.region}:{self.account_id}:robot-application/{self.name}/{self.created_on}"
26
+
27
+ def to_dict(self) -> Dict[str, Any]:
28
+ return {
29
+ "arn": self.arn,
30
+ "name": self.name,
31
+ "sources": self.sources,
32
+ "robotSoftwareSuite": self.robot_software_suite,
33
+ }
34
+
35
+
36
+ class RoboMakerBackend(BaseBackend):
37
+ def __init__(self, region_name: str, account_id: str):
38
+ super().__init__(region_name, account_id)
39
+ self.robot_applications: Dict[str, RobotApplication] = {}
40
+
41
+ def create_robot_application(
42
+ self,
43
+ name: str,
44
+ sources: List[Dict[str, str]],
45
+ robot_software_suite: Dict[str, str],
46
+ ) -> RobotApplication:
47
+ """
48
+ The tags and environment parameters are not yet implemented
49
+ """
50
+ app = RobotApplication(
51
+ account_id=self.account_id,
52
+ region=self.region_name,
53
+ name=name,
54
+ sources=sources,
55
+ robot_software_suite=robot_software_suite,
56
+ )
57
+ self.robot_applications[name] = app
58
+ return app
59
+
60
+ def describe_robot_application(self, application: str) -> RobotApplication:
61
+ return self.robot_applications[application]
62
+
63
+ def delete_robot_application(self, application: str) -> None:
64
+ self.robot_applications.pop(application)
65
+
66
+ def list_robot_applications(self) -> Iterable[RobotApplication]:
67
+ """
68
+ Currently returns all applications - none of the parameters are taken into account
69
+ """
70
+ return self.robot_applications.values()
71
+
72
+
73
+ robomaker_backends = BackendDict(RoboMakerBackend, "robomaker")
@@ -0,0 +1,46 @@
1
+ import json
2
+
3
+ from moto.core.responses import BaseResponse
4
+ from .models import robomaker_backends, RoboMakerBackend
5
+
6
+
7
+ class RoboMakerResponse(BaseResponse):
8
+ def __init__(self) -> None:
9
+ super().__init__(service_name="robomaker")
10
+
11
+ @property
12
+ def robomaker_backend(self) -> RoboMakerBackend:
13
+ return robomaker_backends[self.current_account][self.region]
14
+
15
+ def create_robot_application(self) -> str:
16
+ name = self._get_param("name")
17
+ sources = self._get_param("sources")
18
+ robot_software_suite = self._get_param("robotSoftwareSuite")
19
+ app = self.robomaker_backend.create_robot_application(
20
+ name=name,
21
+ sources=sources,
22
+ robot_software_suite=robot_software_suite,
23
+ )
24
+ return json.dumps(app.to_dict())
25
+
26
+ def describe_robot_application(self) -> str:
27
+ application = self._get_param("application")
28
+ app = self.robomaker_backend.describe_robot_application(
29
+ application=application,
30
+ )
31
+ return json.dumps(app.to_dict())
32
+
33
+ def delete_robot_application(self) -> str:
34
+ application = self._get_param("application")
35
+ self.robomaker_backend.delete_robot_application(
36
+ application=application,
37
+ )
38
+ return "{}"
39
+
40
+ def list_robot_applications(self) -> str:
41
+ robot_applications = self.robomaker_backend.list_robot_applications()
42
+ return json.dumps(
43
+ dict(
44
+ robotApplicationSummaries=[app.to_dict() for app in robot_applications]
45
+ )
46
+ )
moto/robomaker/urls.py ADDED
@@ -0,0 +1,16 @@
1
+ from .responses import RoboMakerResponse
2
+
3
+ url_bases = [
4
+ r"https?://robomaker\.(.+)\.amazonaws\.com",
5
+ ]
6
+
7
+
8
+ response = RoboMakerResponse()
9
+
10
+
11
+ url_paths = {
12
+ "{0}/createRobotApplication$": response.dispatch,
13
+ "{0}/deleteRobotApplication$": response.dispatch,
14
+ "{0}/describeRobotApplication$": response.dispatch,
15
+ "{0}/listRobotApplications$": response.dispatch,
16
+ }
moto/s3/responses.py CHANGED
@@ -1169,25 +1169,35 @@ class S3Response(BaseResponse):
1169
1169
  ) -> TYPE_RESPONSE:
1170
1170
  length = len(response_content)
1171
1171
  last = length - 1
1172
+
1172
1173
  _, rspec = request.headers.get("range").split("=")
1173
1174
  if "," in rspec:
1174
- raise NotImplementedError("Multiple range specifiers not supported")
1175
+ return 200, response_headers, response_content
1176
+
1177
+ try:
1178
+ begin, end = [int(i) if i else None for i in rspec.split("-")]
1179
+ except ValueError:
1180
+ # if we can't parse the Range header, S3 just treat the request as a non-range request
1181
+ return 200, response_headers, response_content
1175
1182
 
1176
- def toint(i: Any) -> Optional[int]:
1177
- return int(i) if i else None
1183
+ if (begin is None and end == 0) or (begin is not None and begin > last):
1184
+ raise InvalidRange(
1185
+ actual_size=str(length), range_requested=request.headers.get("range")
1186
+ )
1178
1187
 
1179
- begin, end = map(toint, rspec.split("-"))
1180
1188
  if begin is not None: # byte range
1181
1189
  end = last if end is None else min(end, last)
1182
1190
  elif end is not None: # suffix byte range
1183
1191
  begin = length - min(end, length)
1184
1192
  end = last
1185
1193
  else:
1186
- return 400, response_headers, ""
1187
- if begin < 0 or end > last or begin > min(end, last):
1188
- raise InvalidRange(
1189
- actual_size=str(length), range_requested=request.headers.get("range")
1190
- )
1194
+ # Treat as non-range request
1195
+ return 200, response_headers, response_content
1196
+
1197
+ if begin > min(end, last):
1198
+ # Treat as non-range request if after the logic is applied, the start of the range is greater than the end
1199
+ return 200, response_headers, response_content
1200
+
1191
1201
  response_headers["content-range"] = f"bytes {begin}-{end}/{length}"
1192
1202
  content = response_content[begin : end + 1]
1193
1203
  response_headers["content-length"] = len(content)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: moto
3
- Version: 4.2.3.dev16
3
+ Version: 4.2.3.dev18
4
4
  Home-page: https://github.com/getmoto/moto
5
5
  Author: Steve Pulec
6
6
  Author-email: "spulec@gmail.com"
@@ -1,5 +1,5 @@
1
- moto/__init__.py,sha256=kCcZiaceHIsAsT9Wln067PpnaHjzIsCIJTA0dMBej7Y,9630
2
- moto/backend_index.py,sha256=CXt1WInpx_9a2USMqIkiEoWFqRdsASOuE7AzbVp5a6A,10629
1
+ moto/__init__.py,sha256=scWAFJIX7hNkCH6TadubHaTAZM0F64noiLRxYabf1T4,9689
2
+ moto/backend_index.py,sha256=JDpbrcbt5e30v7D8c5IsxbqIDUXTvm4OuClX6V81cJU,10707
3
3
  moto/backends.py,sha256=rC9WUMUUWmVmX7ZEfXpVKAQAw6oI8qYobCEPxP2Zv9U,1805
4
4
  moto/server.py,sha256=cp8kIe5jVOm7Z2BlNN2AMbTfrRvLBEKSb4mt7O8nu34,2858
5
5
  moto/settings.py,sha256=BTqhtAWFmDoy5aG_o248d7KK5Dj3Hiv1wuX54PJu5tc,5243
@@ -788,6 +788,10 @@ moto/resourcegroupstaggingapi/__init__.py,sha256=lrbLhm-ParAY1uy-A77tZTfUp4116IY
788
788
  moto/resourcegroupstaggingapi/models.py,sha256=t-jnaupRfXDTXifhHh-W9vziXhR6Yu2qWQ0C6tH6WY0,29866
789
789
  moto/resourcegroupstaggingapi/responses.py,sha256=-9_msYeAFuQqmfcHjShWkLpQCtnXxWk8vUJMOpR3zh8,3051
790
790
  moto/resourcegroupstaggingapi/urls.py,sha256=NO2uLmbvCRCUjm-IbRnXDC_BR_lzwjxjCylgSedZb3o,178
791
+ moto/robomaker/__init__.py,sha256=DSxUFBQvEVR4jaG2VGUdzqwlOOBGXnrx9mbcGoYYpUE,203
792
+ moto/robomaker/models.py,sha256=0ZX4WIN0PzimhvnsmFvo9hPX3MeWF0fRSXE-v8ulrrs,2292
793
+ moto/robomaker/responses.py,sha256=J9FJE_8DKp9pxdzVancXY3qlm6XUM041Lh3ULB4BIgg,1561
794
+ moto/robomaker/urls.py,sha256=bWI4R347OSGc1HtvRTvzOftRq9BDk38e-6Xot56RkiU,375
791
795
  moto/route53/__init__.py,sha256=oS_OqM4XQvRXdrnDF4MHEGmkx6wAU1-ds6b_VBfa4Uc,127
792
796
  moto/route53/exceptions.py,sha256=QETbYYhhLgmxvuY-BHDpldm5QX8LTTLCaDzZQKIdpco,5527
793
797
  moto/route53/models.py,sha256=LJPfRFUSAjW8oYqsR3QnrEkS70EJ2ib2Z6xfThfSaTU,37145
@@ -807,7 +811,7 @@ moto/s3/config.py,sha256=xrV-Uj3BMBz40lbyjmktbaLg5UR7Z6Rx8W5yyw7kIUg,4810
807
811
  moto/s3/exceptions.py,sha256=iIrIq5QfR5LVFIyCULhZfJuOx0jyXdgAyBmXw_CRFgM,15785
808
812
  moto/s3/models.py,sha256=koKn0vyVyNbYcv6SDEhggrt5RSDVqs1f0XHfiFhE9Zo,95206
809
813
  moto/s3/notifications.py,sha256=0C-jJXnNKApy6TX0jLL8esx7xzQ251a76fwGmdod-FA,4012
810
- moto/s3/responses.py,sha256=fP7ZVv8RShW6y3hBVfgagZlnPdF6WWr-4E_o1rEjoXk,124677
814
+ moto/s3/responses.py,sha256=gnHN9DShMfoWGTLRwplGQplfXLQRpYcJduaeZCyAsiI,125084
811
815
  moto/s3/select_object_content.py,sha256=NxQLKVML2_bqMRO4vQCMVkaKsV7XCE4kUFnMGVzi8h4,2184
812
816
  moto/s3/urls.py,sha256=XI4Z2_A7R4Z0I9o5pQ-9NNtkHvbyH0xgzJ__KbJG4hc,1005
813
817
  moto/s3/utils.py,sha256=T7eKBz3xDR20af9CxoJQHNgX3PElnHuIhxnr7Dr7neI,7137
@@ -1030,10 +1034,10 @@ moto/xray/mock_client.py,sha256=nYl8JVJbl3OY-tnUafkVOG4K4-cFm5bsft3Hxo7fKwI,3809
1030
1034
  moto/xray/models.py,sha256=0QL6nmhpVVwAiyi9aw4pBwVTRhqPW9oIy2uwPDhPKug,11179
1031
1035
  moto/xray/responses.py,sha256=p2xsg2-P9h_1DCyuBC7GenmC5L64tXAX6a-XCb2j5-o,6316
1032
1036
  moto/xray/urls.py,sha256=R6T3gMwobWipukWcC1DQ36CU1Rjt6oqBDoe-7HqaIZU,393
1033
- moto-4.2.3.dev16.dist-info/AUTHORS.md,sha256=dDUhasV8HGSkzb7zj7a0b3alnqY0P1LPOyOUNoo8Mpo,2976
1034
- moto-4.2.3.dev16.dist-info/LICENSE,sha256=8S75_TlqE-kIeGMLG0-rRxxu2ct6SM8quyUWKBYyIY4,10834
1035
- moto-4.2.3.dev16.dist-info/METADATA,sha256=p9m3u6vE3ZTIbgcg3Dwp57PSY0lgfNKTZKni-F3u7mM,12102
1036
- moto-4.2.3.dev16.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
1037
- moto-4.2.3.dev16.dist-info/entry_points.txt,sha256=aPovbZuFXCwt8_m2vcolpH4Qr3rOF3yXeRElP9Zkauo,49
1038
- moto-4.2.3.dev16.dist-info/top_level.txt,sha256=TETRKAPcAAvoZDkSkwQiZtTSr-1gzaEAXVm9FmZKj8s,5
1039
- moto-4.2.3.dev16.dist-info/RECORD,,
1037
+ moto-4.2.3.dev18.dist-info/AUTHORS.md,sha256=dDUhasV8HGSkzb7zj7a0b3alnqY0P1LPOyOUNoo8Mpo,2976
1038
+ moto-4.2.3.dev18.dist-info/LICENSE,sha256=8S75_TlqE-kIeGMLG0-rRxxu2ct6SM8quyUWKBYyIY4,10834
1039
+ moto-4.2.3.dev18.dist-info/METADATA,sha256=H30Vnw_DeGHUxJhuxo0RsoB6H7vh5AI6pamxLY-kuX0,12102
1040
+ moto-4.2.3.dev18.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
1041
+ moto-4.2.3.dev18.dist-info/entry_points.txt,sha256=aPovbZuFXCwt8_m2vcolpH4Qr3rOF3yXeRElP9Zkauo,49
1042
+ moto-4.2.3.dev18.dist-info/top_level.txt,sha256=TETRKAPcAAvoZDkSkwQiZtTSr-1gzaEAXVm9FmZKj8s,5
1043
+ moto-4.2.3.dev18.dist-info/RECORD,,