Skip to content

Commit be775e6

Browse files
authored
feat(secret): add network edge certificate secret type (#242)
1 parent a4d2ba2 commit be775e6

File tree

8 files changed

+88
-12
lines changed

8 files changed

+88
-12
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .types import ListSecretsRequestOrderBy
44
from .types import Product
55
from .types import SecretStatus
6+
from .types import SecretType
67
from .types import SecretVersionStatus
78
from .types import AccessSecretVersionResponse
89
from .types import ListSecretVersionsResponse
@@ -17,6 +18,7 @@
1718
"ListSecretsRequestOrderBy",
1819
"Product",
1920
"SecretStatus",
21+
"SecretType",
2022
"SecretVersionStatus",
2123
"AccessSecretVersionResponse",
2224
"ListSecretVersionsResponse",

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from .types import (
1515
ListSecretsRequestOrderBy,
1616
Product,
17+
SecretType,
1718
SecretVersionStatus,
1819
AccessSecretVersionResponse,
1920
ListSecretVersionsResponse,
@@ -57,6 +58,7 @@ async def create_secret(
5758
self,
5859
*,
5960
name: str,
61+
type_: SecretType,
6062
region: Optional[Region] = None,
6163
project_id: Optional[str] = None,
6264
tags: Optional[List[str]] = None,
@@ -70,12 +72,17 @@ async def create_secret(
7072
:param name: Name of the secret.
7173
:param tags: List of the secret's tags.
7274
:param description: Description of the secret.
75+
:param type_: Type of the secret.
76+
(Optional.) See `Secret.Type` enum for description of values. If not specified, the type is `Opaque`.
7377
:return: :class:`Secret <Secret>`
7478
7579
Usage:
7680
::
7781
78-
result = await api.create_secret(name="example")
82+
result = await api.create_secret(
83+
name="example",
84+
type_=unknown_secret_type,
85+
)
7986
"""
8087

8188
param_region = validate_path_param(
@@ -88,6 +95,7 @@ async def create_secret(
8895
body=marshal_CreateSecretRequest(
8996
CreateSecretRequest(
9097
name=name,
98+
type_=type_,
9199
region=region,
92100
project_id=project_id,
93101
tags=tags,
@@ -367,8 +375,9 @@ async def add_secret_owner(
367375
Allow a product to use the secret.
368376
:param region: Region to target. If none is passed will use default region from the config.
369377
:param secret_id: ID of the secret.
370-
:param product_name: (Deprecated: use product field) ID of the product to add (see product enum).
371-
:param product: ID of the product to add (see product enum).
378+
:param product_name: (Deprecated: use `product` field) Name of the product to add.
379+
:param product: ID of the product to add.
380+
See `Product` enum for description of values.
372381
373382
Usage:
374383
::

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from dateutil import parser
1212
from .types import (
1313
Product,
14+
SecretType,
1415
AccessSecretVersionResponse,
1516
ListSecretVersionsResponse,
1617
ListSecretsResponse,
@@ -62,6 +63,9 @@ def unmarshal_Secret(data: Any) -> Secret:
6263
field = data.get("tags", None)
6364
args["tags"] = field
6465

66+
field = data.get("type", None)
67+
args["type_"] = field
68+
6569
field = data.get("updated_at", None)
6670
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
6771

@@ -213,6 +217,7 @@ def marshal_CreateSecretRequest(
213217
"name": request.name,
214218
"project_id": request.project_id or defaults.default_project_id,
215219
"tags": request.tags,
220+
"type": SecretType(request.type_),
216221
}
217222

218223

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

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ def __str__(self) -> str:
3939
return str(self.value)
4040

4141

42+
class SecretType(str, Enum):
43+
UNKNOWN_SECRET_TYPE = "unknown_secret_type"
44+
OPAQUE = "opaque"
45+
NETWORK_EDGE_CERTIFICATE = "network_edge_certificate"
46+
47+
def __str__(self) -> str:
48+
return str(self.value)
49+
50+
4251
class SecretVersionStatus(str, Enum):
4352
UNKNOWN = "unknown"
4453
ENABLED = "enabled"
@@ -216,7 +225,13 @@ class Secret:
216225

217226
is_managed: bool
218227
"""
219-
True for secrets that are managed by another product.
228+
Returns `true` for secrets that are managed by another product.
229+
"""
230+
231+
type_: SecretType
232+
"""
233+
Type of the secret.
234+
See `Secret.Type` enum for description of values.
220235
"""
221236

222237
region: Region
@@ -299,6 +314,12 @@ class CreateSecretRequest:
299314
Description of the secret.
300315
"""
301316

317+
type_: SecretType
318+
"""
319+
Type of the secret.
320+
(Optional.) See `Secret.Type` enum for description of values. If not specified, the type is `Opaque`.
321+
"""
322+
302323

303324
@dataclass
304325
class GetSecretRequest:
@@ -426,13 +447,14 @@ class AddSecretOwnerRequest:
426447

427448
product_name: Optional[str]
428449
"""
429-
(Deprecated: use product field) ID of the product to add (see product enum).
450+
(Deprecated: use `product` field) Name of the product to add.
430451
:deprecated
431452
"""
432453

433454
product: Product
434455
"""
435-
ID of the product to add (see product enum).
456+
ID of the product to add.
457+
See `Product` enum for description of values.
436458
"""
437459

438460

scaleway/scaleway/secret/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .types import ListSecretsRequestOrderBy
44
from .types import Product
55
from .types import SecretStatus
6+
from .types import SecretType
67
from .types import SecretVersionStatus
78
from .types import AccessSecretVersionResponse
89
from .types import ListSecretVersionsResponse
@@ -17,6 +18,7 @@
1718
"ListSecretsRequestOrderBy",
1819
"Product",
1920
"SecretStatus",
21+
"SecretType",
2022
"SecretVersionStatus",
2123
"AccessSecretVersionResponse",
2224
"ListSecretVersionsResponse",

scaleway/scaleway/secret/v1alpha1/api.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from .types import (
1515
ListSecretsRequestOrderBy,
1616
Product,
17+
SecretType,
1718
SecretVersionStatus,
1819
AccessSecretVersionResponse,
1920
ListSecretVersionsResponse,
@@ -57,6 +58,7 @@ def create_secret(
5758
self,
5859
*,
5960
name: str,
61+
type_: SecretType,
6062
region: Optional[Region] = None,
6163
project_id: Optional[str] = None,
6264
tags: Optional[List[str]] = None,
@@ -70,12 +72,17 @@ def create_secret(
7072
:param name: Name of the secret.
7173
:param tags: List of the secret's tags.
7274
:param description: Description of the secret.
75+
:param type_: Type of the secret.
76+
(Optional.) See `Secret.Type` enum for description of values. If not specified, the type is `Opaque`.
7377
:return: :class:`Secret <Secret>`
7478
7579
Usage:
7680
::
7781
78-
result = api.create_secret(name="example")
82+
result = api.create_secret(
83+
name="example",
84+
type_=unknown_secret_type,
85+
)
7986
"""
8087

8188
param_region = validate_path_param(
@@ -88,6 +95,7 @@ def create_secret(
8895
body=marshal_CreateSecretRequest(
8996
CreateSecretRequest(
9097
name=name,
98+
type_=type_,
9199
region=region,
92100
project_id=project_id,
93101
tags=tags,
@@ -367,8 +375,9 @@ def add_secret_owner(
367375
Allow a product to use the secret.
368376
:param region: Region to target. If none is passed will use default region from the config.
369377
:param secret_id: ID of the secret.
370-
:param product_name: (Deprecated: use product field) ID of the product to add (see product enum).
371-
:param product: ID of the product to add (see product enum).
378+
:param product_name: (Deprecated: use `product` field) Name of the product to add.
379+
:param product: ID of the product to add.
380+
See `Product` enum for description of values.
372381
373382
Usage:
374383
::

scaleway/scaleway/secret/v1alpha1/marshalling.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from dateutil import parser
1212
from .types import (
1313
Product,
14+
SecretType,
1415
AccessSecretVersionResponse,
1516
ListSecretVersionsResponse,
1617
ListSecretsResponse,
@@ -62,6 +63,9 @@ def unmarshal_Secret(data: Any) -> Secret:
6263
field = data.get("tags", None)
6364
args["tags"] = field
6465

66+
field = data.get("type", None)
67+
args["type_"] = field
68+
6569
field = data.get("updated_at", None)
6670
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
6771

@@ -213,6 +217,7 @@ def marshal_CreateSecretRequest(
213217
"name": request.name,
214218
"project_id": request.project_id or defaults.default_project_id,
215219
"tags": request.tags,
220+
"type": SecretType(request.type_),
216221
}
217222

218223

scaleway/scaleway/secret/v1alpha1/types.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ def __str__(self) -> str:
3939
return str(self.value)
4040

4141

42+
class SecretType(str, Enum):
43+
UNKNOWN_SECRET_TYPE = "unknown_secret_type"
44+
OPAQUE = "opaque"
45+
NETWORK_EDGE_CERTIFICATE = "network_edge_certificate"
46+
47+
def __str__(self) -> str:
48+
return str(self.value)
49+
50+
4251
class SecretVersionStatus(str, Enum):
4352
UNKNOWN = "unknown"
4453
ENABLED = "enabled"
@@ -216,7 +225,13 @@ class Secret:
216225

217226
is_managed: bool
218227
"""
219-
True for secrets that are managed by another product.
228+
Returns `true` for secrets that are managed by another product.
229+
"""
230+
231+
type_: SecretType
232+
"""
233+
Type of the secret.
234+
See `Secret.Type` enum for description of values.
220235
"""
221236

222237
region: Region
@@ -299,6 +314,12 @@ class CreateSecretRequest:
299314
Description of the secret.
300315
"""
301316

317+
type_: SecretType
318+
"""
319+
Type of the secret.
320+
(Optional.) See `Secret.Type` enum for description of values. If not specified, the type is `Opaque`.
321+
"""
322+
302323

303324
@dataclass
304325
class GetSecretRequest:
@@ -426,13 +447,14 @@ class AddSecretOwnerRequest:
426447

427448
product_name: Optional[str]
428449
"""
429-
(Deprecated: use product field) ID of the product to add (see product enum).
450+
(Deprecated: use `product` field) Name of the product to add.
430451
:deprecated
431452
"""
432453

433454
product: Product
434455
"""
435-
ID of the product to add (see product enum).
456+
ID of the product to add.
457+
See `Product` enum for description of values.
436458
"""
437459

438460

0 commit comments

Comments
 (0)