Skip to content

Commit efe78ed

Browse files
authored
feat(secret_manager): add protection in secret creation (#424)
1 parent 0e55382 commit efe78ed

File tree

6 files changed

+28
-0
lines changed

6 files changed

+28
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ async def create_secret(
6868
*,
6969
name: str,
7070
type_: SecretType,
71+
is_protected: bool,
7172
region: Optional[Region] = None,
7273
project_id: Optional[str] = None,
7374
tags: Optional[List[str]] = None,
@@ -89,6 +90,8 @@ async def create_secret(
8990
(Optional.) Location of the secret in the directory structure. If not specified, the path is `/`.
9091
:param ephemeral_policy: Ephemeral policy of the secret.
9192
(Optional.) Policy that defines whether/when a secret's versions expire. By default, the policy is applied to all the secret's versions.
93+
:param is_protected: Returns `true` if secret protection is enabled on a given secret.
94+
A protected secret cannot be deleted.
9295
:return: :class:`Secret <Secret>`
9396
9497
Usage:
@@ -97,6 +100,7 @@ async def create_secret(
97100
result = await api.create_secret(
98101
name="example",
99102
type_=unknown_secret_type,
103+
is_protected=True,
100104
)
101105
"""
102106

@@ -111,6 +115,7 @@ async def create_secret(
111115
CreateSecretRequest(
112116
name=name,
113117
type_=type_,
118+
is_protected=is_protected,
114119
region=region,
115120
project_id=project_id,
116121
tags=tags,

scaleway-async/scaleway_async/secret/v1alpha1/marshalling.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ def marshal_CreateSecretRequest(
402402
request.ephemeral_policy, defaults
403403
)
404404

405+
if request.is_protected is not None:
406+
output["is_protected"] = request.is_protected
407+
405408
if request.name is not None:
406409
output["name"] = request.name
407410

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ class CreateSecretRequest:
482482
(Optional.) Policy that defines whether/when a secret's versions expire. By default, the policy is applied to all the secret's versions.
483483
"""
484484

485+
is_protected: bool
486+
"""
487+
Returns `true` if secret protection is enabled on a given secret.
488+
A protected secret cannot be deleted.
489+
"""
490+
485491

486492
@dataclass
487493
class CreateFolderRequest:

scaleway/scaleway/secret/v1alpha1/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def create_secret(
6868
*,
6969
name: str,
7070
type_: SecretType,
71+
is_protected: bool,
7172
region: Optional[Region] = None,
7273
project_id: Optional[str] = None,
7374
tags: Optional[List[str]] = None,
@@ -89,6 +90,8 @@ def create_secret(
8990
(Optional.) Location of the secret in the directory structure. If not specified, the path is `/`.
9091
:param ephemeral_policy: Ephemeral policy of the secret.
9192
(Optional.) Policy that defines whether/when a secret's versions expire. By default, the policy is applied to all the secret's versions.
93+
:param is_protected: Returns `true` if secret protection is enabled on a given secret.
94+
A protected secret cannot be deleted.
9295
:return: :class:`Secret <Secret>`
9396
9497
Usage:
@@ -97,6 +100,7 @@ def create_secret(
97100
result = api.create_secret(
98101
name="example",
99102
type_=unknown_secret_type,
103+
is_protected=True,
100104
)
101105
"""
102106

@@ -111,6 +115,7 @@ def create_secret(
111115
CreateSecretRequest(
112116
name=name,
113117
type_=type_,
118+
is_protected=is_protected,
114119
region=region,
115120
project_id=project_id,
116121
tags=tags,

scaleway/scaleway/secret/v1alpha1/marshalling.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ def marshal_CreateSecretRequest(
402402
request.ephemeral_policy, defaults
403403
)
404404

405+
if request.is_protected is not None:
406+
output["is_protected"] = request.is_protected
407+
405408
if request.name is not None:
406409
output["name"] = request.name
407410

scaleway/scaleway/secret/v1alpha1/types.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ class CreateSecretRequest:
482482
(Optional.) Policy that defines whether/when a secret's versions expire. By default, the policy is applied to all the secret's versions.
483483
"""
484484

485+
is_protected: bool
486+
"""
487+
Returns `true` if secret protection is enabled on a given secret.
488+
A protected secret cannot be deleted.
489+
"""
490+
485491

486492
@dataclass
487493
class CreateFolderRequest:

0 commit comments

Comments
 (0)