Skip to content

feat(serverless_jobs): enable secrets #739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions scaleway-async/scaleway_async/jobs/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,9 @@ async def create_job_definition_secrets(
region: Optional[Region] = None,
) -> CreateJobDefinitionSecretsResponse:
"""
:param job_definition_id: UUID of the job definition to get.
:param secrets: Secrets to inject into the job.
Create a secret reference within a job definition.
:param job_definition_id: UUID of the job definition.
:param secrets: List of secrets to inject into the job.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`CreateJobDefinitionSecretsResponse <CreateJobDefinitionSecretsResponse>`

Expand Down Expand Up @@ -461,8 +462,9 @@ async def get_job_definition_secret(
region: Optional[Region] = None,
) -> Secret:
"""
:param job_definition_id:
:param secret_id:
Get a secret references within a job definition.
:param job_definition_id: UUID of the job definition.
:param secret_id: UUID of the secret reference within the job.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`Secret <Secret>`

Expand Down Expand Up @@ -498,7 +500,8 @@ async def list_job_definition_secrets(
region: Optional[Region] = None,
) -> ListJobDefinitionSecretsResponse:
"""
:param job_definition_id:
List secrets references within a job definition.
:param job_definition_id: UUID of the job definition.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`ListJobDefinitionSecretsResponse <ListJobDefinitionSecretsResponse>`

Expand Down Expand Up @@ -536,13 +539,14 @@ async def update_job_definition_secret(
env_var_name: Optional[str] = None,
) -> Secret:
"""
:param job_definition_id:
:param secret_id:
Update a secret reference within a job definition.
:param job_definition_id: UUID of the job definition.
:param secret_id: UUID of the secret reference within the job.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_manager_version:
:param path:
:param secret_manager_version: Version of the secret in Secret Manager.
:param path: Path of the secret to mount inside the job (either `path` or `env_var_name` must be set).
One-Of ('secret_config'): at most one of 'path', 'env_var_name' could be set.
:param env_var_name:
:param env_var_name: Environment variable name used to expose the secret inside the job (either `path` or `env_var_name` must be set).
One-Of ('secret_config'): at most one of 'path', 'env_var_name' could be set.
:return: :class:`Secret <Secret>`

Expand Down Expand Up @@ -590,8 +594,9 @@ async def delete_job_definition_secret(
region: Optional[Region] = None,
) -> None:
"""
:param job_definition_id:
:param secret_id:
Delete a secret reference within a job definition.
:param job_definition_id: UUID of the job definition.
:param secret_id: UUID of the secret reference within the job.
:param region: Region to target. If none is passed will use default region from the config.

Usage:
Expand Down
46 changes: 44 additions & 2 deletions scaleway-async/scaleway_async/jobs/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,19 @@ class CreateJobDefinitionSecretsRequestSecretConfig:
@dataclass
class Secret:
secret_id: str
"""
UUID of the secret reference within the job.
"""

secret_manager_id: str
"""
UUID of the secret in Secret Manager.
"""

secret_manager_version: str
"""
Version of the secret in Secret Manager.
"""

file: Optional[SecretFile]

Expand Down Expand Up @@ -254,12 +263,12 @@ class CreateJobDefinitionRequest:
class CreateJobDefinitionSecretsRequest:
job_definition_id: str
"""
UUID of the job definition to get.
UUID of the job definition.
"""

secrets: List[CreateJobDefinitionSecretsRequestSecretConfig]
"""
Secrets to inject into the job.
List of secrets to inject into the job.
"""

region: Optional[Region]
Expand All @@ -271,6 +280,9 @@ class CreateJobDefinitionSecretsRequest:
@dataclass
class CreateJobDefinitionSecretsResponse:
secrets: List[Secret]
"""
List of secrets created.
"""


@dataclass
Expand All @@ -289,8 +301,14 @@ class DeleteJobDefinitionRequest:
@dataclass
class DeleteJobDefinitionSecretRequest:
job_definition_id: str
"""
UUID of the job definition.
"""

secret_id: str
"""
UUID of the secret reference within the job.
"""

region: Optional[Region]
"""
Expand All @@ -314,8 +332,14 @@ class GetJobDefinitionRequest:
@dataclass
class GetJobDefinitionSecretRequest:
job_definition_id: str
"""
UUID of the job definition.
"""

secret_id: str
"""
UUID of the secret reference within the job.
"""

region: Optional[Region]
"""
Expand Down Expand Up @@ -352,6 +376,9 @@ class JobsLimits:
@dataclass
class ListJobDefinitionSecretsRequest:
job_definition_id: str
"""
UUID of the job definition.
"""

region: Optional[Region]
"""
Expand All @@ -362,8 +389,14 @@ class ListJobDefinitionSecretsRequest:
@dataclass
class ListJobDefinitionSecretsResponse:
secrets: List[Secret]
"""
List of secret references within a job definition.
"""

total_count: int
"""
Total count of secret references within a job definition.
"""


@dataclass
Expand Down Expand Up @@ -540,15 +573,24 @@ class UpdateJobDefinitionRequest:
@dataclass
class UpdateJobDefinitionSecretRequest:
job_definition_id: str
"""
UUID of the job definition.
"""

secret_id: str
"""
UUID of the secret reference within the job.
"""

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

secret_manager_version: Optional[str]
"""
Version of the secret in Secret Manager.
"""

path: Optional[str]

Expand Down
29 changes: 17 additions & 12 deletions scaleway/scaleway/jobs/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,9 @@ def create_job_definition_secrets(
region: Optional[Region] = None,
) -> CreateJobDefinitionSecretsResponse:
"""
:param job_definition_id: UUID of the job definition to get.
:param secrets: Secrets to inject into the job.
Create a secret reference within a job definition.
:param job_definition_id: UUID of the job definition.
:param secrets: List of secrets to inject into the job.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`CreateJobDefinitionSecretsResponse <CreateJobDefinitionSecretsResponse>`

Expand Down Expand Up @@ -461,8 +462,9 @@ def get_job_definition_secret(
region: Optional[Region] = None,
) -> Secret:
"""
:param job_definition_id:
:param secret_id:
Get a secret references within a job definition.
:param job_definition_id: UUID of the job definition.
:param secret_id: UUID of the secret reference within the job.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`Secret <Secret>`

Expand Down Expand Up @@ -498,7 +500,8 @@ def list_job_definition_secrets(
region: Optional[Region] = None,
) -> ListJobDefinitionSecretsResponse:
"""
:param job_definition_id:
List secrets references within a job definition.
:param job_definition_id: UUID of the job definition.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`ListJobDefinitionSecretsResponse <ListJobDefinitionSecretsResponse>`

Expand Down Expand Up @@ -536,13 +539,14 @@ def update_job_definition_secret(
env_var_name: Optional[str] = None,
) -> Secret:
"""
:param job_definition_id:
:param secret_id:
Update a secret reference within a job definition.
:param job_definition_id: UUID of the job definition.
:param secret_id: UUID of the secret reference within the job.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_manager_version:
:param path:
:param secret_manager_version: Version of the secret in Secret Manager.
:param path: Path of the secret to mount inside the job (either `path` or `env_var_name` must be set).
One-Of ('secret_config'): at most one of 'path', 'env_var_name' could be set.
:param env_var_name:
:param env_var_name: Environment variable name used to expose the secret inside the job (either `path` or `env_var_name` must be set).
One-Of ('secret_config'): at most one of 'path', 'env_var_name' could be set.
:return: :class:`Secret <Secret>`

Expand Down Expand Up @@ -590,8 +594,9 @@ def delete_job_definition_secret(
region: Optional[Region] = None,
) -> None:
"""
:param job_definition_id:
:param secret_id:
Delete a secret reference within a job definition.
:param job_definition_id: UUID of the job definition.
:param secret_id: UUID of the secret reference within the job.
:param region: Region to target. If none is passed will use default region from the config.

Usage:
Expand Down
46 changes: 44 additions & 2 deletions scaleway/scaleway/jobs/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,19 @@ class CreateJobDefinitionSecretsRequestSecretConfig:
@dataclass
class Secret:
secret_id: str
"""
UUID of the secret reference within the job.
"""

secret_manager_id: str
"""
UUID of the secret in Secret Manager.
"""

secret_manager_version: str
"""
Version of the secret in Secret Manager.
"""

file: Optional[SecretFile]

Expand Down Expand Up @@ -254,12 +263,12 @@ class CreateJobDefinitionRequest:
class CreateJobDefinitionSecretsRequest:
job_definition_id: str
"""
UUID of the job definition to get.
UUID of the job definition.
"""

secrets: List[CreateJobDefinitionSecretsRequestSecretConfig]
"""
Secrets to inject into the job.
List of secrets to inject into the job.
"""

region: Optional[Region]
Expand All @@ -271,6 +280,9 @@ class CreateJobDefinitionSecretsRequest:
@dataclass
class CreateJobDefinitionSecretsResponse:
secrets: List[Secret]
"""
List of secrets created.
"""


@dataclass
Expand All @@ -289,8 +301,14 @@ class DeleteJobDefinitionRequest:
@dataclass
class DeleteJobDefinitionSecretRequest:
job_definition_id: str
"""
UUID of the job definition.
"""

secret_id: str
"""
UUID of the secret reference within the job.
"""

region: Optional[Region]
"""
Expand All @@ -314,8 +332,14 @@ class GetJobDefinitionRequest:
@dataclass
class GetJobDefinitionSecretRequest:
job_definition_id: str
"""
UUID of the job definition.
"""

secret_id: str
"""
UUID of the secret reference within the job.
"""

region: Optional[Region]
"""
Expand Down Expand Up @@ -352,6 +376,9 @@ class JobsLimits:
@dataclass
class ListJobDefinitionSecretsRequest:
job_definition_id: str
"""
UUID of the job definition.
"""

region: Optional[Region]
"""
Expand All @@ -362,8 +389,14 @@ class ListJobDefinitionSecretsRequest:
@dataclass
class ListJobDefinitionSecretsResponse:
secrets: List[Secret]
"""
List of secret references within a job definition.
"""

total_count: int
"""
Total count of secret references within a job definition.
"""


@dataclass
Expand Down Expand Up @@ -540,15 +573,24 @@ class UpdateJobDefinitionRequest:
@dataclass
class UpdateJobDefinitionSecretRequest:
job_definition_id: str
"""
UUID of the job definition.
"""

secret_id: str
"""
UUID of the secret reference within the job.
"""

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

secret_manager_version: Optional[str]
"""
Version of the secret in Secret Manager.
"""

path: Optional[str]

Expand Down