Skip to content

Commit 3d0ae54

Browse files
authored
feat(secret): upgrade product field to an enum (#197)
1 parent fc65da7 commit 3d0ae54

File tree

8 files changed

+54
-12
lines changed

8 files changed

+54
-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
@@ -1,6 +1,7 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import ListSecretsRequestOrderBy
4+
from .types import Product
45
from .types import SecretStatus
56
from .types import SecretVersionStatus
67
from .types import AccessSecretVersionResponse
@@ -13,6 +14,7 @@
1314

1415
__all__ = [
1516
"ListSecretsRequestOrderBy",
17+
"Product",
1618
"SecretStatus",
1719
"SecretVersionStatus",
1820
"AccessSecretVersionResponse",

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
)
1414
from .types import (
1515
ListSecretsRequestOrderBy,
16+
Product,
1617
SecretVersionStatus,
1718
AccessSecretVersionResponse,
1819
ListSecretVersionsResponse,
@@ -356,21 +357,23 @@ async def add_secret_owner(
356357
self,
357358
*,
358359
secret_id: str,
359-
product_name: str,
360+
product: Product,
360361
region: Optional[Region] = None,
362+
product_name: Optional[str] = None,
361363
) -> Optional[None]:
362364
"""
363365
Allow a product to use the secret.
364366
:param region: Region to target. If none is passed will use default region from the config.
365367
:param secret_id: ID of the secret.
366-
:param product_name: Name of the product to add.
368+
:param product_name: (Deprecated: use product field) ID of the product to add (see product enum).
369+
:param product: ID of the product to add (see product enum).
367370
368371
Usage:
369372
::
370373
371374
result = await api.add_secret_owner(
372375
secret_id="example",
373-
product_name="example",
376+
product=unknown,
374377
)
375378
"""
376379

@@ -385,8 +388,9 @@ async def add_secret_owner(
385388
body=marshal_AddSecretOwnerRequest(
386389
AddSecretOwnerRequest(
387390
secret_id=secret_id,
388-
product_name=product_name,
391+
product=product,
389392
region=region,
393+
product_name=product_name,
390394
),
391395
self.client,
392396
),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
)
1111
from dateutil import parser
1212
from .types import (
13+
Product,
1314
AccessSecretVersionResponse,
1415
ListSecretVersionsResponse,
1516
ListSecretsResponse,
@@ -176,6 +177,7 @@ def marshal_AddSecretOwnerRequest(
176177
defaults: ProfileDefaults,
177178
) -> Dict[str, Any]:
178179
return {
180+
"product": Product(request.product),
179181
"product_name": request.product_name,
180182
}
181183

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ def __str__(self) -> str:
2424
return str(self.value)
2525

2626

27+
class Product(str, Enum):
28+
UNKNOWN = "unknown"
29+
30+
def __str__(self) -> str:
31+
return str(self.value)
32+
33+
2734
class SecretStatus(str, Enum):
2835
READY = "ready"
2936
LOCKED = "locked"
@@ -400,9 +407,15 @@ class AddSecretOwnerRequest:
400407
ID of the secret.
401408
"""
402409

403-
product_name: str
410+
product_name: Optional[str]
411+
"""
412+
(Deprecated: use product field) ID of the product to add (see product enum).
413+
:deprecated
414+
"""
415+
416+
product: Product
404417
"""
405-
Name of the product to add.
418+
ID of the product to add (see product enum).
406419
"""
407420

408421

scaleway/scaleway/secret/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import ListSecretsRequestOrderBy
4+
from .types import Product
45
from .types import SecretStatus
56
from .types import SecretVersionStatus
67
from .types import AccessSecretVersionResponse
@@ -13,6 +14,7 @@
1314

1415
__all__ = [
1516
"ListSecretsRequestOrderBy",
17+
"Product",
1618
"SecretStatus",
1719
"SecretVersionStatus",
1820
"AccessSecretVersionResponse",

scaleway/scaleway/secret/v1alpha1/api.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
)
1414
from .types import (
1515
ListSecretsRequestOrderBy,
16+
Product,
1617
SecretVersionStatus,
1718
AccessSecretVersionResponse,
1819
ListSecretVersionsResponse,
@@ -356,21 +357,23 @@ def add_secret_owner(
356357
self,
357358
*,
358359
secret_id: str,
359-
product_name: str,
360+
product: Product,
360361
region: Optional[Region] = None,
362+
product_name: Optional[str] = None,
361363
) -> Optional[None]:
362364
"""
363365
Allow a product to use the secret.
364366
:param region: Region to target. If none is passed will use default region from the config.
365367
:param secret_id: ID of the secret.
366-
:param product_name: Name of the product to add.
368+
:param product_name: (Deprecated: use product field) ID of the product to add (see product enum).
369+
:param product: ID of the product to add (see product enum).
367370
368371
Usage:
369372
::
370373
371374
result = api.add_secret_owner(
372375
secret_id="example",
373-
product_name="example",
376+
product=unknown,
374377
)
375378
"""
376379

@@ -385,8 +388,9 @@ def add_secret_owner(
385388
body=marshal_AddSecretOwnerRequest(
386389
AddSecretOwnerRequest(
387390
secret_id=secret_id,
388-
product_name=product_name,
391+
product=product,
389392
region=region,
393+
product_name=product_name,
390394
),
391395
self.client,
392396
),

scaleway/scaleway/secret/v1alpha1/marshalling.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
)
1111
from dateutil import parser
1212
from .types import (
13+
Product,
1314
AccessSecretVersionResponse,
1415
ListSecretVersionsResponse,
1516
ListSecretsResponse,
@@ -176,6 +177,7 @@ def marshal_AddSecretOwnerRequest(
176177
defaults: ProfileDefaults,
177178
) -> Dict[str, Any]:
178179
return {
180+
"product": Product(request.product),
179181
"product_name": request.product_name,
180182
}
181183

scaleway/scaleway/secret/v1alpha1/types.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ def __str__(self) -> str:
2424
return str(self.value)
2525

2626

27+
class Product(str, Enum):
28+
UNKNOWN = "unknown"
29+
30+
def __str__(self) -> str:
31+
return str(self.value)
32+
33+
2734
class SecretStatus(str, Enum):
2835
READY = "ready"
2936
LOCKED = "locked"
@@ -400,9 +407,15 @@ class AddSecretOwnerRequest:
400407
ID of the secret.
401408
"""
402409

403-
product_name: str
410+
product_name: Optional[str]
411+
"""
412+
(Deprecated: use product field) ID of the product to add (see product enum).
413+
:deprecated
414+
"""
415+
416+
product: Product
404417
"""
405-
Name of the product to add.
418+
ID of the product to add (see product enum).
406419
"""
407420

408421

0 commit comments

Comments
 (0)