Skip to content

Commit 3ea0371

Browse files
authored
feat(serverless_jobs): enable secrets (#739)
1 parent a546c25 commit 3ea0371

File tree

4 files changed

+122
-28
lines changed

4 files changed

+122
-28
lines changed

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

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,9 @@ async def create_job_definition_secrets(
416416
region: Optional[Region] = None,
417417
) -> CreateJobDefinitionSecretsResponse:
418418
"""
419-
:param job_definition_id: UUID of the job definition to get.
420-
:param secrets: Secrets to inject into the job.
419+
Create a secret reference within a job definition.
420+
:param job_definition_id: UUID of the job definition.
421+
:param secrets: List of secrets to inject into the job.
421422
:param region: Region to target. If none is passed will use default region from the config.
422423
:return: :class:`CreateJobDefinitionSecretsResponse <CreateJobDefinitionSecretsResponse>`
423424
@@ -461,8 +462,9 @@ async def get_job_definition_secret(
461462
region: Optional[Region] = None,
462463
) -> Secret:
463464
"""
464-
:param job_definition_id:
465-
:param secret_id:
465+
Get a secret references within a job definition.
466+
:param job_definition_id: UUID of the job definition.
467+
:param secret_id: UUID of the secret reference within the job.
466468
:param region: Region to target. If none is passed will use default region from the config.
467469
:return: :class:`Secret <Secret>`
468470
@@ -498,7 +500,8 @@ async def list_job_definition_secrets(
498500
region: Optional[Region] = None,
499501
) -> ListJobDefinitionSecretsResponse:
500502
"""
501-
:param job_definition_id:
503+
List secrets references within a job definition.
504+
:param job_definition_id: UUID of the job definition.
502505
:param region: Region to target. If none is passed will use default region from the config.
503506
:return: :class:`ListJobDefinitionSecretsResponse <ListJobDefinitionSecretsResponse>`
504507
@@ -536,13 +539,14 @@ async def update_job_definition_secret(
536539
env_var_name: Optional[str] = None,
537540
) -> Secret:
538541
"""
539-
:param job_definition_id:
540-
:param secret_id:
542+
Update a secret reference within a job definition.
543+
:param job_definition_id: UUID of the job definition.
544+
:param secret_id: UUID of the secret reference within the job.
541545
:param region: Region to target. If none is passed will use default region from the config.
542-
:param secret_manager_version:
543-
:param path:
546+
:param secret_manager_version: Version of the secret in Secret Manager.
547+
:param path: Path of the secret to mount inside the job (either `path` or `env_var_name` must be set).
544548
One-Of ('secret_config'): at most one of 'path', 'env_var_name' could be set.
545-
:param env_var_name:
549+
:param env_var_name: Environment variable name used to expose the secret inside the job (either `path` or `env_var_name` must be set).
546550
One-Of ('secret_config'): at most one of 'path', 'env_var_name' could be set.
547551
:return: :class:`Secret <Secret>`
548552
@@ -590,8 +594,9 @@ async def delete_job_definition_secret(
590594
region: Optional[Region] = None,
591595
) -> None:
592596
"""
593-
:param job_definition_id:
594-
:param secret_id:
597+
Delete a secret reference within a job definition.
598+
:param job_definition_id: UUID of the job definition.
599+
:param secret_id: UUID of the secret reference within the job.
595600
:param region: Region to target. If none is passed will use default region from the config.
596601
597602
Usage:

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

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,19 @@ class CreateJobDefinitionSecretsRequestSecretConfig:
8989
@dataclass
9090
class Secret:
9191
secret_id: str
92+
"""
93+
UUID of the secret reference within the job.
94+
"""
9295

9396
secret_manager_id: str
97+
"""
98+
UUID of the secret in Secret Manager.
99+
"""
94100

95101
secret_manager_version: str
102+
"""
103+
Version of the secret in Secret Manager.
104+
"""
96105

97106
file: Optional[SecretFile]
98107

@@ -254,12 +263,12 @@ class CreateJobDefinitionRequest:
254263
class CreateJobDefinitionSecretsRequest:
255264
job_definition_id: str
256265
"""
257-
UUID of the job definition to get.
266+
UUID of the job definition.
258267
"""
259268

260269
secrets: List[CreateJobDefinitionSecretsRequestSecretConfig]
261270
"""
262-
Secrets to inject into the job.
271+
List of secrets to inject into the job.
263272
"""
264273

265274
region: Optional[Region]
@@ -271,6 +280,9 @@ class CreateJobDefinitionSecretsRequest:
271280
@dataclass
272281
class CreateJobDefinitionSecretsResponse:
273282
secrets: List[Secret]
283+
"""
284+
List of secrets created.
285+
"""
274286

275287

276288
@dataclass
@@ -289,8 +301,14 @@ class DeleteJobDefinitionRequest:
289301
@dataclass
290302
class DeleteJobDefinitionSecretRequest:
291303
job_definition_id: str
304+
"""
305+
UUID of the job definition.
306+
"""
292307

293308
secret_id: str
309+
"""
310+
UUID of the secret reference within the job.
311+
"""
294312

295313
region: Optional[Region]
296314
"""
@@ -314,8 +332,14 @@ class GetJobDefinitionRequest:
314332
@dataclass
315333
class GetJobDefinitionSecretRequest:
316334
job_definition_id: str
335+
"""
336+
UUID of the job definition.
337+
"""
317338

318339
secret_id: str
340+
"""
341+
UUID of the secret reference within the job.
342+
"""
319343

320344
region: Optional[Region]
321345
"""
@@ -352,6 +376,9 @@ class JobsLimits:
352376
@dataclass
353377
class ListJobDefinitionSecretsRequest:
354378
job_definition_id: str
379+
"""
380+
UUID of the job definition.
381+
"""
355382

356383
region: Optional[Region]
357384
"""
@@ -362,8 +389,14 @@ class ListJobDefinitionSecretsRequest:
362389
@dataclass
363390
class ListJobDefinitionSecretsResponse:
364391
secrets: List[Secret]
392+
"""
393+
List of secret references within a job definition.
394+
"""
365395

366396
total_count: int
397+
"""
398+
Total count of secret references within a job definition.
399+
"""
367400

368401

369402
@dataclass
@@ -540,15 +573,24 @@ class UpdateJobDefinitionRequest:
540573
@dataclass
541574
class UpdateJobDefinitionSecretRequest:
542575
job_definition_id: str
576+
"""
577+
UUID of the job definition.
578+
"""
543579

544580
secret_id: str
581+
"""
582+
UUID of the secret reference within the job.
583+
"""
545584

546585
region: Optional[Region]
547586
"""
548587
Region to target. If none is passed will use default region from the config.
549588
"""
550589

551590
secret_manager_version: Optional[str]
591+
"""
592+
Version of the secret in Secret Manager.
593+
"""
552594

553595
path: Optional[str]
554596

scaleway/scaleway/jobs/v1alpha1/api.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,9 @@ def create_job_definition_secrets(
416416
region: Optional[Region] = None,
417417
) -> CreateJobDefinitionSecretsResponse:
418418
"""
419-
:param job_definition_id: UUID of the job definition to get.
420-
:param secrets: Secrets to inject into the job.
419+
Create a secret reference within a job definition.
420+
:param job_definition_id: UUID of the job definition.
421+
:param secrets: List of secrets to inject into the job.
421422
:param region: Region to target. If none is passed will use default region from the config.
422423
:return: :class:`CreateJobDefinitionSecretsResponse <CreateJobDefinitionSecretsResponse>`
423424
@@ -461,8 +462,9 @@ def get_job_definition_secret(
461462
region: Optional[Region] = None,
462463
) -> Secret:
463464
"""
464-
:param job_definition_id:
465-
:param secret_id:
465+
Get a secret references within a job definition.
466+
:param job_definition_id: UUID of the job definition.
467+
:param secret_id: UUID of the secret reference within the job.
466468
:param region: Region to target. If none is passed will use default region from the config.
467469
:return: :class:`Secret <Secret>`
468470
@@ -498,7 +500,8 @@ def list_job_definition_secrets(
498500
region: Optional[Region] = None,
499501
) -> ListJobDefinitionSecretsResponse:
500502
"""
501-
:param job_definition_id:
503+
List secrets references within a job definition.
504+
:param job_definition_id: UUID of the job definition.
502505
:param region: Region to target. If none is passed will use default region from the config.
503506
:return: :class:`ListJobDefinitionSecretsResponse <ListJobDefinitionSecretsResponse>`
504507
@@ -536,13 +539,14 @@ def update_job_definition_secret(
536539
env_var_name: Optional[str] = None,
537540
) -> Secret:
538541
"""
539-
:param job_definition_id:
540-
:param secret_id:
542+
Update a secret reference within a job definition.
543+
:param job_definition_id: UUID of the job definition.
544+
:param secret_id: UUID of the secret reference within the job.
541545
:param region: Region to target. If none is passed will use default region from the config.
542-
:param secret_manager_version:
543-
:param path:
546+
:param secret_manager_version: Version of the secret in Secret Manager.
547+
:param path: Path of the secret to mount inside the job (either `path` or `env_var_name` must be set).
544548
One-Of ('secret_config'): at most one of 'path', 'env_var_name' could be set.
545-
:param env_var_name:
549+
:param env_var_name: Environment variable name used to expose the secret inside the job (either `path` or `env_var_name` must be set).
546550
One-Of ('secret_config'): at most one of 'path', 'env_var_name' could be set.
547551
:return: :class:`Secret <Secret>`
548552
@@ -590,8 +594,9 @@ def delete_job_definition_secret(
590594
region: Optional[Region] = None,
591595
) -> None:
592596
"""
593-
:param job_definition_id:
594-
:param secret_id:
597+
Delete a secret reference within a job definition.
598+
:param job_definition_id: UUID of the job definition.
599+
:param secret_id: UUID of the secret reference within the job.
595600
:param region: Region to target. If none is passed will use default region from the config.
596601
597602
Usage:

scaleway/scaleway/jobs/v1alpha1/types.py

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,19 @@ class CreateJobDefinitionSecretsRequestSecretConfig:
8989
@dataclass
9090
class Secret:
9191
secret_id: str
92+
"""
93+
UUID of the secret reference within the job.
94+
"""
9295

9396
secret_manager_id: str
97+
"""
98+
UUID of the secret in Secret Manager.
99+
"""
94100

95101
secret_manager_version: str
102+
"""
103+
Version of the secret in Secret Manager.
104+
"""
96105

97106
file: Optional[SecretFile]
98107

@@ -254,12 +263,12 @@ class CreateJobDefinitionRequest:
254263
class CreateJobDefinitionSecretsRequest:
255264
job_definition_id: str
256265
"""
257-
UUID of the job definition to get.
266+
UUID of the job definition.
258267
"""
259268

260269
secrets: List[CreateJobDefinitionSecretsRequestSecretConfig]
261270
"""
262-
Secrets to inject into the job.
271+
List of secrets to inject into the job.
263272
"""
264273

265274
region: Optional[Region]
@@ -271,6 +280,9 @@ class CreateJobDefinitionSecretsRequest:
271280
@dataclass
272281
class CreateJobDefinitionSecretsResponse:
273282
secrets: List[Secret]
283+
"""
284+
List of secrets created.
285+
"""
274286

275287

276288
@dataclass
@@ -289,8 +301,14 @@ class DeleteJobDefinitionRequest:
289301
@dataclass
290302
class DeleteJobDefinitionSecretRequest:
291303
job_definition_id: str
304+
"""
305+
UUID of the job definition.
306+
"""
292307

293308
secret_id: str
309+
"""
310+
UUID of the secret reference within the job.
311+
"""
294312

295313
region: Optional[Region]
296314
"""
@@ -314,8 +332,14 @@ class GetJobDefinitionRequest:
314332
@dataclass
315333
class GetJobDefinitionSecretRequest:
316334
job_definition_id: str
335+
"""
336+
UUID of the job definition.
337+
"""
317338

318339
secret_id: str
340+
"""
341+
UUID of the secret reference within the job.
342+
"""
319343

320344
region: Optional[Region]
321345
"""
@@ -352,6 +376,9 @@ class JobsLimits:
352376
@dataclass
353377
class ListJobDefinitionSecretsRequest:
354378
job_definition_id: str
379+
"""
380+
UUID of the job definition.
381+
"""
355382

356383
region: Optional[Region]
357384
"""
@@ -362,8 +389,14 @@ class ListJobDefinitionSecretsRequest:
362389
@dataclass
363390
class ListJobDefinitionSecretsResponse:
364391
secrets: List[Secret]
392+
"""
393+
List of secret references within a job definition.
394+
"""
365395

366396
total_count: int
397+
"""
398+
Total count of secret references within a job definition.
399+
"""
367400

368401

369402
@dataclass
@@ -540,15 +573,24 @@ class UpdateJobDefinitionRequest:
540573
@dataclass
541574
class UpdateJobDefinitionSecretRequest:
542575
job_definition_id: str
576+
"""
577+
UUID of the job definition.
578+
"""
543579

544580
secret_id: str
581+
"""
582+
UUID of the secret reference within the job.
583+
"""
545584

546585
region: Optional[Region]
547586
"""
548587
Region to target. If none is passed will use default region from the config.
549588
"""
550589

551590
secret_manager_version: Optional[str]
591+
"""
592+
Version of the secret in Secret Manager.
593+
"""
552594

553595
path: Optional[str]
554596

0 commit comments

Comments
 (0)