Skip to content
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
38 changes: 32 additions & 6 deletions scaleway-async/scaleway_async/secret/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ async def get_secret_by_name(
*,
secret_name: str,
region: Optional[Region] = None,
project_id: Optional[str] = None,
) -> Secret:
"""
Get metadata using the secret's ID.
Retrieve the metadata of a secret specified by the `region` and the `secret_id` parameters.
Retrieve the metadata of a secret specified by the `region`, `secret_id` and `project_id` parameters.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_name: Name of the secret.
:param project_id: ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret in all Projects.
:return: :class:`Secret <Secret>`

Usage:
Expand All @@ -155,6 +158,9 @@ async def get_secret_by_name(
res = self._request(
"GET",
f"/secret-manager/v1alpha1/regions/{param_region}/secrets-by-name/{param_secret_name}",
params={
"project_id": project_id or self.client.default_project_id,
},
)

self._throw_on_error(res)
Expand Down Expand Up @@ -406,7 +412,7 @@ async def create_secret_version(
:param data: The base64-encoded secret payload of the version.
:param description: Description of the version.
:param disable_previous: Disable the previous secret version.
Optional. If there is no previous version or if the previous version was already disabled, does nothing.
(Optional.) If there is no previous version or if the previous version was already disabled, does nothing.
:param data_crc32: (Optional.) The CRC32 checksum of the data as a base-10 integer.
If specified, Secret Manager will verify the integrity of the data received against the given CRC32 checksum. An error is returned if the CRC32 does not match. If, however, the CRC32 matches, it will be stored and returned along with the SecretVersion on future access requests.
:return: :class:`SecretVersion <SecretVersion>`
Expand Down Expand Up @@ -553,14 +559,17 @@ async def get_secret_version_by_name(
secret_name: str,
revision: str,
region: Optional[Region] = None,
project_id: Optional[str] = None,
) -> SecretVersion:
"""
Get metadata of a secret's version using the secret's name.
Retrieve the metadata of a secret's given version specified by the `region`, `secret_name` and `revision` parameters.
Retrieve the metadata of a secret's given version specified by the `region`, `secret_name`, `revision` and `project_id` parameters.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_name: Name of the secret.
:param revision: Version number.
The first version of the secret is numbered 1, and all subsequent revisions augment by 1. Value can be a number or "latest".
:param project_id: ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret version in all Projects.
:return: :class:`SecretVersion <SecretVersion>`

Usage:
Expand All @@ -581,6 +590,9 @@ async def get_secret_version_by_name(
res = self._request(
"GET",
f"/secret-manager/v1alpha1/regions/{param_region}/secrets-by-name/{param_secret_name}/versions/{param_revision}",
params={
"project_id": project_id or self.client.default_project_id,
},
)

self._throw_on_error(res)
Expand Down Expand Up @@ -725,15 +737,18 @@ async def list_secret_versions_by_name(
page: Optional[int] = None,
page_size: Optional[int] = None,
status: Optional[List[SecretVersionStatus]] = None,
project_id: Optional[str] = None,
) -> ListSecretVersionsResponse:
"""
List versions of a secret using the secret's name.
Retrieve the list of a given secret's versions specified by the `secret_name` and `region` parameters.
Retrieve the list of a given secret's versions specified by the `secret_name`,`region` and `project_id` parameters.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_name: Name of the secret.
:param page:
:param page_size:
:param status: Filter results by status.
:param project_id: ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret in all Projects.
:return: :class:`ListSecretVersionsResponse <ListSecretVersionsResponse>`

Usage:
Expand All @@ -753,6 +768,7 @@ async def list_secret_versions_by_name(
params={
"page": page,
"page_size": page_size or self.client.default_page_size,
"project_id": project_id or self.client.default_project_id,
"status": status,
},
)
Expand All @@ -768,15 +784,18 @@ async def list_secret_versions_by_name_all(
page: Optional[int] = None,
page_size: Optional[int] = None,
status: Optional[List[SecretVersionStatus]] = None,
project_id: Optional[str] = None,
) -> List[SecretVersion]:
"""
List versions of a secret using the secret's name.
Retrieve the list of a given secret's versions specified by the `secret_name` and `region` parameters.
Retrieve the list of a given secret's versions specified by the `secret_name`,`region` and `project_id` parameters.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_name: Name of the secret.
:param page:
:param page_size:
:param status: Filter results by status.
:param project_id: ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret in all Projects.
:return: :class:`List[ListSecretVersionsResponse] <List[ListSecretVersionsResponse]>`

Usage:
Expand All @@ -795,6 +814,7 @@ async def list_secret_versions_by_name_all(
"page": page,
"page_size": page_size,
"status": status,
"project_id": project_id,
},
)

Expand Down Expand Up @@ -921,14 +941,17 @@ async def access_secret_version_by_name(
secret_name: str,
revision: str,
region: Optional[Region] = None,
project_id: Optional[str] = None,
) -> AccessSecretVersionResponse:
"""
Access a secret's version using the secret's name.
Access sensitive data in a secret's version specified by the `region`, `secret_name` and `revision` parameters.
Access sensitive data in a secret's version specified by the `region`, `secret_name`, `revision` and `project_id` parameters.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_name: Name of the secret.
:param revision: Version number.
The first version of the secret is numbered 1, and all subsequent revisions augment by 1. Value can be a number or "latest".
:param project_id: ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret version in all Projects.
:return: :class:`AccessSecretVersionResponse <AccessSecretVersionResponse>`

Usage:
Expand All @@ -949,6 +972,9 @@ async def access_secret_version_by_name(
res = self._request(
"GET",
f"/secret-manager/v1alpha1/regions/{param_region}/secrets-by-name/{param_secret_name}/versions/{param_revision}/access",
params={
"project_id": project_id or self.client.default_project_id,
},
)

self._throw_on_error(res)
Expand Down
26 changes: 25 additions & 1 deletion scaleway-async/scaleway_async/secret/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ class GetSecretByNameRequest:
Name of the secret.
"""

project_id: Optional[str]
"""
ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret in all Projects.
"""


@dataclass
class UpdateSecretRequest:
Expand Down Expand Up @@ -425,7 +431,7 @@ class CreateSecretVersionRequest:
disable_previous: Optional[bool]
"""
Disable the previous secret version.
Optional. If there is no previous version or if the previous version was already disabled, does nothing.
(Optional.) If there is no previous version or if the previous version was already disabled, does nothing.
"""

data_crc32: Optional[int]
Expand Down Expand Up @@ -521,6 +527,12 @@ class GetSecretVersionByNameRequest:
The first version of the secret is numbered 1, and all subsequent revisions augment by 1. Value can be a number or "latest".
"""

project_id: Optional[str]
"""
ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret version in all Projects.
"""


@dataclass
class UpdateSecretVersionRequest:
Expand Down Expand Up @@ -589,6 +601,12 @@ class ListSecretVersionsByNameRequest:
Filter results by status.
"""

project_id: Optional[str]
"""
ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret in all Projects.
"""


@dataclass
class EnableSecretVersionRequest:
Expand Down Expand Up @@ -665,6 +683,12 @@ class AccessSecretVersionByNameRequest:
The first version of the secret is numbered 1, and all subsequent revisions augment by 1. Value can be a number or "latest".
"""

project_id: Optional[str]
"""
ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret version in all Projects.
"""


@dataclass
class DestroySecretVersionRequest:
Expand Down
38 changes: 32 additions & 6 deletions scaleway/scaleway/secret/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ def get_secret_by_name(
*,
secret_name: str,
region: Optional[Region] = None,
project_id: Optional[str] = None,
) -> Secret:
"""
Get metadata using the secret's ID.
Retrieve the metadata of a secret specified by the `region` and the `secret_id` parameters.
Retrieve the metadata of a secret specified by the `region`, `secret_id` and `project_id` parameters.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_name: Name of the secret.
:param project_id: ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret in all Projects.
:return: :class:`Secret <Secret>`

Usage:
Expand All @@ -155,6 +158,9 @@ def get_secret_by_name(
res = self._request(
"GET",
f"/secret-manager/v1alpha1/regions/{param_region}/secrets-by-name/{param_secret_name}",
params={
"project_id": project_id or self.client.default_project_id,
},
)

self._throw_on_error(res)
Expand Down Expand Up @@ -406,7 +412,7 @@ def create_secret_version(
:param data: The base64-encoded secret payload of the version.
:param description: Description of the version.
:param disable_previous: Disable the previous secret version.
Optional. If there is no previous version or if the previous version was already disabled, does nothing.
(Optional.) If there is no previous version or if the previous version was already disabled, does nothing.
:param data_crc32: (Optional.) The CRC32 checksum of the data as a base-10 integer.
If specified, Secret Manager will verify the integrity of the data received against the given CRC32 checksum. An error is returned if the CRC32 does not match. If, however, the CRC32 matches, it will be stored and returned along with the SecretVersion on future access requests.
:return: :class:`SecretVersion <SecretVersion>`
Expand Down Expand Up @@ -553,14 +559,17 @@ def get_secret_version_by_name(
secret_name: str,
revision: str,
region: Optional[Region] = None,
project_id: Optional[str] = None,
) -> SecretVersion:
"""
Get metadata of a secret's version using the secret's name.
Retrieve the metadata of a secret's given version specified by the `region`, `secret_name` and `revision` parameters.
Retrieve the metadata of a secret's given version specified by the `region`, `secret_name`, `revision` and `project_id` parameters.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_name: Name of the secret.
:param revision: Version number.
The first version of the secret is numbered 1, and all subsequent revisions augment by 1. Value can be a number or "latest".
:param project_id: ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret version in all Projects.
:return: :class:`SecretVersion <SecretVersion>`

Usage:
Expand All @@ -581,6 +590,9 @@ def get_secret_version_by_name(
res = self._request(
"GET",
f"/secret-manager/v1alpha1/regions/{param_region}/secrets-by-name/{param_secret_name}/versions/{param_revision}",
params={
"project_id": project_id or self.client.default_project_id,
},
)

self._throw_on_error(res)
Expand Down Expand Up @@ -725,15 +737,18 @@ def list_secret_versions_by_name(
page: Optional[int] = None,
page_size: Optional[int] = None,
status: Optional[List[SecretVersionStatus]] = None,
project_id: Optional[str] = None,
) -> ListSecretVersionsResponse:
"""
List versions of a secret using the secret's name.
Retrieve the list of a given secret's versions specified by the `secret_name` and `region` parameters.
Retrieve the list of a given secret's versions specified by the `secret_name`,`region` and `project_id` parameters.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_name: Name of the secret.
:param page:
:param page_size:
:param status: Filter results by status.
:param project_id: ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret in all Projects.
:return: :class:`ListSecretVersionsResponse <ListSecretVersionsResponse>`

Usage:
Expand All @@ -753,6 +768,7 @@ def list_secret_versions_by_name(
params={
"page": page,
"page_size": page_size or self.client.default_page_size,
"project_id": project_id or self.client.default_project_id,
"status": status,
},
)
Expand All @@ -768,15 +784,18 @@ def list_secret_versions_by_name_all(
page: Optional[int] = None,
page_size: Optional[int] = None,
status: Optional[List[SecretVersionStatus]] = None,
project_id: Optional[str] = None,
) -> List[SecretVersion]:
"""
List versions of a secret using the secret's name.
Retrieve the list of a given secret's versions specified by the `secret_name` and `region` parameters.
Retrieve the list of a given secret's versions specified by the `secret_name`,`region` and `project_id` parameters.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_name: Name of the secret.
:param page:
:param page_size:
:param status: Filter results by status.
:param project_id: ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret in all Projects.
:return: :class:`List[ListSecretVersionsResponse] <List[ListSecretVersionsResponse]>`

Usage:
Expand All @@ -795,6 +814,7 @@ def list_secret_versions_by_name_all(
"page": page,
"page_size": page_size,
"status": status,
"project_id": project_id,
},
)

Expand Down Expand Up @@ -921,14 +941,17 @@ def access_secret_version_by_name(
secret_name: str,
revision: str,
region: Optional[Region] = None,
project_id: Optional[str] = None,
) -> AccessSecretVersionResponse:
"""
Access a secret's version using the secret's name.
Access sensitive data in a secret's version specified by the `region`, `secret_name` and `revision` parameters.
Access sensitive data in a secret's version specified by the `region`, `secret_name`, `revision` and `project_id` parameters.
:param region: Region to target. If none is passed will use default region from the config.
:param secret_name: Name of the secret.
:param revision: Version number.
The first version of the secret is numbered 1, and all subsequent revisions augment by 1. Value can be a number or "latest".
:param project_id: ID of the Project to target.
(Optional.) If not specified, Secret Manager will look for the secret version in all Projects.
:return: :class:`AccessSecretVersionResponse <AccessSecretVersionResponse>`

Usage:
Expand All @@ -949,6 +972,9 @@ def access_secret_version_by_name(
res = self._request(
"GET",
f"/secret-manager/v1alpha1/regions/{param_region}/secrets-by-name/{param_secret_name}/versions/{param_revision}/access",
params={
"project_id": project_id or self.client.default_project_id,
},
)

self._throw_on_error(res)
Expand Down
Loading