Skip to content

Commit cfcab04

Browse files
authored
feat(datawarehouse): add shard_count params (scaleway#1570)
1 parent 7ef50d8 commit cfcab04

File tree

6 files changed

+78
-12
lines changed

6 files changed

+78
-12
lines changed

scaleway-async/scaleway_async/datawarehouse/v1beta1/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ async def create_deployment(
391391
region: Optional[ScwRegion] = None,
392392
project_id: Optional[str] = None,
393393
tags: Optional[list[str]] = None,
394+
shard_count: Optional[int] = None,
394395
endpoints: Optional[list[EndpointSpec]] = None,
395396
) -> Deployment:
396397
"""
@@ -406,6 +407,7 @@ async def create_deployment(
406407
:param region: Region to target. If none is passed will use default region from the config.
407408
:param project_id: The Project ID on which the deployment will be created.
408409
:param tags: Tags to apply to the deployment.
410+
:param shard_count: Number of shard for the deployment.
409411
:param endpoints: Endpoints to associate with the deployment.
410412
:return: :class:`Deployment <Deployment>`
411413
@@ -442,6 +444,7 @@ async def create_deployment(
442444
region=region,
443445
project_id=project_id,
444446
tags=tags,
447+
shard_count=shard_count,
445448
endpoints=endpoints,
446449
),
447450
self.client,

scaleway-async/scaleway_async/datawarehouse/v1beta1/marshalling.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,6 @@ def unmarshal_Deployment(data: Any) -> Deployment:
198198
else:
199199
args["tags"] = []
200200

201-
field = data.get("version", None)
202-
if field is not None:
203-
args["version"] = field
204-
else:
205-
args["version"] = None
206-
207201
field = data.get("created_at", None)
208202
if field is not None:
209203
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
@@ -216,12 +210,24 @@ def unmarshal_Deployment(data: Any) -> Deployment:
216210
else:
217211
args["updated_at"] = None
218212

213+
field = data.get("version", None)
214+
if field is not None:
215+
args["version"] = field
216+
else:
217+
args["version"] = None
218+
219219
field = data.get("replica_count", None)
220220
if field is not None:
221221
args["replica_count"] = field
222222
else:
223223
args["replica_count"] = 0
224224

225+
field = data.get("shard_count", None)
226+
if field is not None:
227+
args["shard_count"] = field
228+
else:
229+
args["shard_count"] = 0
230+
225231
field = data.get("cpu_min", None)
226232
if field is not None:
227233
args["cpu_min"] = field
@@ -374,6 +380,12 @@ def unmarshal_Preset(data: Any) -> Preset:
374380
else:
375381
args["replica_count"] = 0
376382

383+
field = data.get("shard_count", None)
384+
if field is not None:
385+
args["shard_count"] = field
386+
else:
387+
args["shard_count"] = 0
388+
377389
return Preset(**args)
378390

379391

@@ -570,6 +582,9 @@ def marshal_CreateDeploymentRequest(
570582
if request.tags is not None:
571583
output["tags"] = request.tags
572584

585+
if request.shard_count is not None:
586+
output["shard_count"] = request.shard_count
587+
573588
if request.endpoints is not None:
574589
output["endpoints"] = [
575590
marshal_EndpointSpec(item, defaults) for item in request.endpoints

scaleway-async/scaleway_async/datawarehouse/v1beta1/types.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ class Deployment:
185185
Number of replicas for the deployment.
186186
"""
187187

188+
shard_count: int
189+
"""
190+
Number of shards for the deployment.
191+
"""
192+
188193
cpu_min: int
189194
"""
190195
Minimum CPU count for the deployment.
@@ -253,6 +258,11 @@ class Preset:
253258
Number of replicas for the preset.
254259
"""
255260

261+
shard_count: int
262+
"""
263+
Number of shards for the preset.
264+
"""
265+
256266

257267
@dataclass
258268
class User:
@@ -350,6 +360,11 @@ class CreateDeploymentRequest:
350360
Tags to apply to the deployment.
351361
"""
352362

363+
shard_count: Optional[int] = 0
364+
"""
365+
Number of shard for the deployment.
366+
"""
367+
353368
endpoints: Optional[list[EndpointSpec]] = field(default_factory=list)
354369
"""
355370
Endpoints to associate with the deployment.

scaleway/scaleway/datawarehouse/v1beta1/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ def create_deployment(
389389
region: Optional[ScwRegion] = None,
390390
project_id: Optional[str] = None,
391391
tags: Optional[list[str]] = None,
392+
shard_count: Optional[int] = None,
392393
endpoints: Optional[list[EndpointSpec]] = None,
393394
) -> Deployment:
394395
"""
@@ -404,6 +405,7 @@ def create_deployment(
404405
:param region: Region to target. If none is passed will use default region from the config.
405406
:param project_id: The Project ID on which the deployment will be created.
406407
:param tags: Tags to apply to the deployment.
408+
:param shard_count: Number of shard for the deployment.
407409
:param endpoints: Endpoints to associate with the deployment.
408410
:return: :class:`Deployment <Deployment>`
409411
@@ -440,6 +442,7 @@ def create_deployment(
440442
region=region,
441443
project_id=project_id,
442444
tags=tags,
445+
shard_count=shard_count,
443446
endpoints=endpoints,
444447
),
445448
self.client,

scaleway/scaleway/datawarehouse/v1beta1/marshalling.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,6 @@ def unmarshal_Deployment(data: Any) -> Deployment:
198198
else:
199199
args["tags"] = []
200200

201-
field = data.get("version", None)
202-
if field is not None:
203-
args["version"] = field
204-
else:
205-
args["version"] = None
206-
207201
field = data.get("created_at", None)
208202
if field is not None:
209203
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
@@ -216,12 +210,24 @@ def unmarshal_Deployment(data: Any) -> Deployment:
216210
else:
217211
args["updated_at"] = None
218212

213+
field = data.get("version", None)
214+
if field is not None:
215+
args["version"] = field
216+
else:
217+
args["version"] = None
218+
219219
field = data.get("replica_count", None)
220220
if field is not None:
221221
args["replica_count"] = field
222222
else:
223223
args["replica_count"] = 0
224224

225+
field = data.get("shard_count", None)
226+
if field is not None:
227+
args["shard_count"] = field
228+
else:
229+
args["shard_count"] = 0
230+
225231
field = data.get("cpu_min", None)
226232
if field is not None:
227233
args["cpu_min"] = field
@@ -374,6 +380,12 @@ def unmarshal_Preset(data: Any) -> Preset:
374380
else:
375381
args["replica_count"] = 0
376382

383+
field = data.get("shard_count", None)
384+
if field is not None:
385+
args["shard_count"] = field
386+
else:
387+
args["shard_count"] = 0
388+
377389
return Preset(**args)
378390

379391

@@ -570,6 +582,9 @@ def marshal_CreateDeploymentRequest(
570582
if request.tags is not None:
571583
output["tags"] = request.tags
572584

585+
if request.shard_count is not None:
586+
output["shard_count"] = request.shard_count
587+
573588
if request.endpoints is not None:
574589
output["endpoints"] = [
575590
marshal_EndpointSpec(item, defaults) for item in request.endpoints

scaleway/scaleway/datawarehouse/v1beta1/types.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ class Deployment:
185185
Number of replicas for the deployment.
186186
"""
187187

188+
shard_count: int
189+
"""
190+
Number of shards for the deployment.
191+
"""
192+
188193
cpu_min: int
189194
"""
190195
Minimum CPU count for the deployment.
@@ -253,6 +258,11 @@ class Preset:
253258
Number of replicas for the preset.
254259
"""
255260

261+
shard_count: int
262+
"""
263+
Number of shards for the preset.
264+
"""
265+
256266

257267
@dataclass
258268
class User:
@@ -350,6 +360,11 @@ class CreateDeploymentRequest:
350360
Tags to apply to the deployment.
351361
"""
352362

363+
shard_count: Optional[int] = 0
364+
"""
365+
Number of shard for the deployment.
366+
"""
367+
353368
endpoints: Optional[list[EndpointSpec]] = field(default_factory=list)
354369
"""
355370
Endpoints to associate with the deployment.

0 commit comments

Comments
 (0)