Skip to content

Commit 0dffb8c

Browse files
authored
chore(serverless_jobs): rename id to job_definition_id and id to job_run_id (#381)
1 parent 2af43c3 commit 0dffb8c

File tree

4 files changed

+88
-72
lines changed

4 files changed

+88
-72
lines changed

scaleway-async/scaleway_async/jobs/v1alpha1/api.py

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -125,25 +125,27 @@ async def create_job_definition(
125125
async def get_job_definition(
126126
self,
127127
*,
128-
id: str,
128+
job_definition_id: str,
129129
region: Optional[Region] = None,
130130
) -> JobDefinition:
131131
"""
132132
133133
Usage:
134134
::
135135
136-
result = await api.get_job_definition(id="example")
136+
result = await api.get_job_definition(job_definition_id="example")
137137
"""
138138

139139
param_region = validate_path_param(
140140
"region", region or self.client.default_region
141141
)
142-
param_id = validate_path_param("id", id)
142+
param_job_definition_id = validate_path_param(
143+
"job_definition_id", job_definition_id
144+
)
143145

144146
res = self._request(
145147
"GET",
146-
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-definitions/{param_id}",
148+
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-definitions/{param_job_definition_id}",
147149
)
148150

149151
self._throw_on_error(res)
@@ -218,7 +220,7 @@ async def list_job_definitions_all(
218220
async def update_job_definition(
219221
self,
220222
*,
221-
id: str,
223+
job_definition_id: str,
222224
region: Optional[Region] = None,
223225
name: Optional[str] = None,
224226
cpu_limit: Optional[int] = None,
@@ -234,20 +236,22 @@ async def update_job_definition(
234236
Usage:
235237
::
236238
237-
result = await api.update_job_definition(id="example")
239+
result = await api.update_job_definition(job_definition_id="example")
238240
"""
239241

240242
param_region = validate_path_param(
241243
"region", region or self.client.default_region
242244
)
243-
param_id = validate_path_param("id", id)
245+
param_job_definition_id = validate_path_param(
246+
"job_definition_id", job_definition_id
247+
)
244248

245249
res = self._request(
246250
"PATCH",
247-
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-definitions/{param_id}",
251+
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-definitions/{param_job_definition_id}",
248252
body=marshal_UpdateJobDefinitionRequest(
249253
UpdateJobDefinitionRequest(
250-
id=id,
254+
job_definition_id=job_definition_id,
251255
region=region,
252256
name=name,
253257
cpu_limit=cpu_limit,
@@ -268,25 +272,27 @@ async def update_job_definition(
268272
async def delete_job_definition(
269273
self,
270274
*,
271-
id: str,
275+
job_definition_id: str,
272276
region: Optional[Region] = None,
273277
) -> Optional[None]:
274278
"""
275279
276280
Usage:
277281
::
278282
279-
result = await api.delete_job_definition(id="example")
283+
result = await api.delete_job_definition(job_definition_id="example")
280284
"""
281285

282286
param_region = validate_path_param(
283287
"region", region or self.client.default_region
284288
)
285-
param_id = validate_path_param("id", id)
289+
param_job_definition_id = validate_path_param(
290+
"job_definition_id", job_definition_id
291+
)
286292

287293
res = self._request(
288294
"DELETE",
289-
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-definitions/{param_id}",
295+
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-definitions/{param_job_definition_id}",
290296
)
291297

292298
self._throw_on_error(res)
@@ -295,25 +301,27 @@ async def delete_job_definition(
295301
async def start_job_definition(
296302
self,
297303
*,
298-
id: str,
304+
job_definition_id: str,
299305
region: Optional[Region] = None,
300306
) -> JobRun:
301307
"""
302308
303309
Usage:
304310
::
305311
306-
result = await api.start_job_definition(id="example")
312+
result = await api.start_job_definition(job_definition_id="example")
307313
"""
308314

309315
param_region = validate_path_param(
310316
"region", region or self.client.default_region
311317
)
312-
param_id = validate_path_param("id", id)
318+
param_job_definition_id = validate_path_param(
319+
"job_definition_id", job_definition_id
320+
)
313321

314322
res = self._request(
315323
"POST",
316-
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-definitions/{param_id}/start",
324+
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-definitions/{param_job_definition_id}/start",
317325
)
318326

319327
self._throw_on_error(res)
@@ -322,25 +330,25 @@ async def start_job_definition(
322330
async def get_job_run(
323331
self,
324332
*,
325-
id: str,
333+
job_run_id: str,
326334
region: Optional[Region] = None,
327335
) -> JobRun:
328336
"""
329337
330338
Usage:
331339
::
332340
333-
result = await api.get_job_run(id="example")
341+
result = await api.get_job_run(job_run_id="example")
334342
"""
335343

336344
param_region = validate_path_param(
337345
"region", region or self.client.default_region
338346
)
339-
param_id = validate_path_param("id", id)
347+
param_job_run_id = validate_path_param("job_run_id", job_run_id)
340348

341349
res = self._request(
342350
"GET",
343-
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-runs/{param_id}",
351+
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-runs/{param_job_run_id}",
344352
)
345353

346354
self._throw_on_error(res)
@@ -349,25 +357,25 @@ async def get_job_run(
349357
async def stop_job_run(
350358
self,
351359
*,
352-
id: str,
360+
job_run_id: str,
353361
region: Optional[Region] = None,
354362
) -> JobRun:
355363
"""
356364
357365
Usage:
358366
::
359367
360-
result = await api.stop_job_run(id="example")
368+
result = await api.stop_job_run(job_run_id="example")
361369
"""
362370

363371
param_region = validate_path_param(
364372
"region", region or self.client.default_region
365373
)
366-
param_id = validate_path_param("id", id)
374+
param_job_run_id = validate_path_param("job_run_id", job_run_id)
367375

368376
res = self._request(
369377
"POST",
370-
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-runs/{param_id}/stop",
378+
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-runs/{param_job_run_id}/stop",
371379
)
372380

373381
self._throw_on_error(res)
@@ -380,7 +388,7 @@ async def list_job_runs(
380388
page: Optional[int] = None,
381389
page_size: Optional[int] = None,
382390
order_by: ListJobRunsRequestOrderBy = ListJobRunsRequestOrderBy.CREATED_AT_ASC,
383-
id: Optional[str] = None,
391+
job_definition_id: Optional[str] = None,
384392
project_id: Optional[str] = None,
385393
) -> ListJobRunsResponse:
386394
"""
@@ -399,7 +407,7 @@ async def list_job_runs(
399407
"GET",
400408
f"/serverless-jobs/v1alpha1/regions/{param_region}/job-runs",
401409
params={
402-
"id": id,
410+
"job_definition_id": job_definition_id,
403411
"order_by": order_by,
404412
"page": page,
405413
"page_size": page_size or self.client.default_page_size,
@@ -417,7 +425,7 @@ async def list_job_runs_all(
417425
page: Optional[int] = None,
418426
page_size: Optional[int] = None,
419427
order_by: Optional[ListJobRunsRequestOrderBy] = None,
420-
id: Optional[str] = None,
428+
job_definition_id: Optional[str] = None,
421429
project_id: Optional[str] = None,
422430
) -> List[JobRun]:
423431
"""
@@ -438,7 +446,7 @@ async def list_job_runs_all(
438446
"page": page,
439447
"page_size": page_size,
440448
"order_by": order_by,
441-
"id": id,
449+
"job_definition_id": job_definition_id,
442450
"project_id": project_id,
443451
},
444452
)

scaleway-async/scaleway_async/jobs/v1alpha1/types.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class GetJobDefinitionRequest:
151151
Region to target. If none is passed will use default region from the config.
152152
"""
153153

154-
id: str
154+
job_definition_id: str
155155

156156

157157
@dataclass
@@ -177,7 +177,7 @@ class UpdateJobDefinitionRequest:
177177
Region to target. If none is passed will use default region from the config.
178178
"""
179179

180-
id: str
180+
job_definition_id: str
181181

182182
name: Optional[str]
183183

@@ -203,7 +203,7 @@ class DeleteJobDefinitionRequest:
203203
Region to target. If none is passed will use default region from the config.
204204
"""
205205

206-
id: str
206+
job_definition_id: str
207207

208208

209209
@dataclass
@@ -213,7 +213,7 @@ class StartJobDefinitionRequest:
213213
Region to target. If none is passed will use default region from the config.
214214
"""
215215

216-
id: str
216+
job_definition_id: str
217217

218218

219219
@dataclass
@@ -223,7 +223,7 @@ class GetJobRunRequest:
223223
Region to target. If none is passed will use default region from the config.
224224
"""
225225

226-
id: str
226+
job_run_id: str
227227

228228

229229
@dataclass
@@ -233,7 +233,7 @@ class StopJobRunRequest:
233233
Region to target. If none is passed will use default region from the config.
234234
"""
235235

236-
id: str
236+
job_run_id: str
237237

238238

239239
@dataclass
@@ -249,6 +249,6 @@ class ListJobRunsRequest:
249249

250250
order_by: Optional[ListJobRunsRequestOrderBy]
251251

252-
id: Optional[str]
252+
job_definition_id: Optional[str]
253253

254254
project_id: Optional[str]

0 commit comments

Comments
 (0)