Skip to content

Commit e4d7174

Browse files
feat(key_manager): update doc with asymmetric usage (#1227)
Co-authored-by: Mia-Cross <lmarabese@scaleway.com>
1 parent 3a59547 commit e4d7174

File tree

6 files changed

+136
-116
lines changed

6 files changed

+136
-116
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +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

4-
from typing import List, Optional
4+
from typing import Optional
55

66
from scaleway_core.api import API
77
from scaleway_core.bridge import (
@@ -72,18 +72,18 @@ async def create_key(
7272
name: Optional[str] = None,
7373
usage: Optional[KeyUsage] = None,
7474
description: Optional[str] = None,
75-
tags: Optional[List[str]] = None,
75+
tags: Optional[list[str]] = None,
7676
rotation_policy: Optional[KeyRotationPolicy] = None,
7777
origin: Optional[KeyOrigin] = None,
7878
) -> Key:
7979
"""
8080
Create a key.
81-
Create a key in a given region specified by the `region` parameter. Keys only support symmetric encryption. You can use keys to encrypt or decrypt arbitrary payloads, or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**.
81+
Create a key in a given region specified by the `region` parameter. You can use keys to encrypt or decrypt arbitrary payloads, to sign and verify messages or to generate data encryption keys. **Data encryption keys are not stored in Key Manager**.
8282
:param unprotected: Default value is `false`.
8383
:param region: Region to target. If none is passed will use default region from the config.
8484
:param project_id: ID of the Project containing the key.
8585
:param name: (Optional) Name of the key.
86-
:param usage: See the `Key.Algorithm.SymmetricEncryption` enum for a description of values.
86+
:param usage: See the `Key.Usage` enum for a description of possible values.
8787
:param description: (Optional) Description of the key.
8888
:param tags: (Optional) List of the key's tags.
8989
:param rotation_policy: If not specified, no rotation policy will be applied to the key.
@@ -199,7 +199,7 @@ async def update_key(
199199
region: Optional[ScwRegion] = None,
200200
name: Optional[str] = None,
201201
description: Optional[str] = None,
202-
tags: Optional[List[str]] = None,
202+
tags: Optional[list[str]] = None,
203203
rotation_policy: Optional[KeyRotationPolicy] = None,
204204
) -> Key:
205205
"""
@@ -462,7 +462,7 @@ async def list_keys(
462462
order_by: Optional[ListKeysRequestOrderBy] = None,
463463
page: Optional[int] = None,
464464
page_size: Optional[int] = None,
465-
tags: Optional[List[str]] = None,
465+
tags: Optional[list[str]] = None,
466466
name: Optional[str] = None,
467467
usage: Optional[ListKeysRequestUsage] = None,
468468
) -> ListKeysResponse:
@@ -523,10 +523,10 @@ async def list_keys_all(
523523
order_by: Optional[ListKeysRequestOrderBy] = None,
524524
page: Optional[int] = None,
525525
page_size: Optional[int] = None,
526-
tags: Optional[List[str]] = None,
526+
tags: Optional[list[str]] = None,
527527
name: Optional[str] = None,
528528
usage: Optional[ListKeysRequestUsage] = None,
529-
) -> List[Key]:
529+
) -> list[Key]:
530530
"""
531531
List keys.
532532
Retrieve a list of keys across all Projects in an Organization or within a specific Project. You must specify the `region`, and either the `organization_id` or the `project_id`.
@@ -540,7 +540,7 @@ async def list_keys_all(
540540
:param tags: (Optional) List of tags to filter on.
541541
:param name: (Optional) Filter by key name.
542542
:param usage: Select from symmetric encryption, asymmetric encryption, or asymmetric signing.
543-
:return: :class:`List[Key] <List[Key]>`
543+
:return: :class:`list[Key] <list[Key]>`
544544
545545
Usage:
546546
::
@@ -929,7 +929,7 @@ async def list_algorithms(
929929
self,
930930
*,
931931
region: Optional[ScwRegion] = None,
932-
usages: Optional[List[ListAlgorithmsRequestUsage]] = None,
932+
usages: Optional[list[ListAlgorithmsRequestUsage]] = None,
933933
) -> ListAlgorithmsResponse:
934934
"""
935935
List all available algorithms.

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

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +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

4-
from typing import Any, Dict
4+
from typing import Any
55
from dateutil import parser
66

77
from scaleway_core.profile import ProfileDefaults
@@ -11,6 +11,8 @@
1111
)
1212
from .types import (
1313
DataKeyAlgorithmSymmetricEncryption,
14+
KeyAlgorithmAsymmetricEncryption,
15+
KeyAlgorithmAsymmetricSigning,
1416
KeyAlgorithmSymmetricEncryption,
1517
KeyOrigin,
1618
KeyState,
@@ -43,7 +45,7 @@ def unmarshal_KeyRotationPolicy(data: Any) -> KeyRotationPolicy:
4345
"Unmarshalling the type 'KeyRotationPolicy' failed as data isn't a dictionary."
4446
)
4547

46-
args: Dict[str, Any] = {}
48+
args: dict[str, Any] = {}
4749

4850
field = data.get("rotation_period", None)
4951
if field is not None:
@@ -68,7 +70,7 @@ def unmarshal_KeyUsage(data: Any) -> KeyUsage:
6870
"Unmarshalling the type 'KeyUsage' failed as data isn't a dictionary."
6971
)
7072

71-
args: Dict[str, Any] = {}
73+
args: dict[str, Any] = {}
7274

7375
field = data.get("symmetric_encryption", None)
7476
if field is not None:
@@ -82,13 +84,17 @@ def unmarshal_KeyUsage(data: Any) -> KeyUsage:
8284
if field is not None:
8385
args["asymmetric_encryption"] = field
8486
else:
85-
args["asymmetric_encryption"] = None
87+
args["asymmetric_encryption"] = (
88+
KeyAlgorithmAsymmetricEncryption.UNKNOWN_ASYMMETRIC_ENCRYPTION
89+
)
8690

8791
field = data.get("asymmetric_signing", None)
8892
if field is not None:
8993
args["asymmetric_signing"] = field
9094
else:
91-
args["asymmetric_signing"] = None
95+
args["asymmetric_signing"] = (
96+
KeyAlgorithmAsymmetricSigning.UNKNOWN_ASYMMETRIC_SIGNING
97+
)
9298

9399
return KeyUsage(**args)
94100

@@ -99,7 +105,7 @@ def unmarshal_Key(data: Any) -> Key:
99105
"Unmarshalling the type 'Key' failed as data isn't a dictionary."
100106
)
101107

102-
args: Dict[str, Any] = {}
108+
args: dict[str, Any] = {}
103109

104110
field = data.get("id", None)
105111
if field is not None:
@@ -214,7 +220,7 @@ def unmarshal_DataKey(data: Any) -> DataKey:
214220
"Unmarshalling the type 'DataKey' failed as data isn't a dictionary."
215221
)
216222

217-
args: Dict[str, Any] = {}
223+
args: dict[str, Any] = {}
218224

219225
field = data.get("key_id", None)
220226
if field is not None:
@@ -257,7 +263,7 @@ def unmarshal_DecryptResponse(data: Any) -> DecryptResponse:
257263
"Unmarshalling the type 'DecryptResponse' failed as data isn't a dictionary."
258264
)
259265

260-
args: Dict[str, Any] = {}
266+
args: dict[str, Any] = {}
261267

262268
field = data.get("key_id", None)
263269
if field is not None:
@@ -286,7 +292,7 @@ def unmarshal_EncryptResponse(data: Any) -> EncryptResponse:
286292
"Unmarshalling the type 'EncryptResponse' failed as data isn't a dictionary."
287293
)
288294

289-
args: Dict[str, Any] = {}
295+
args: dict[str, Any] = {}
290296

291297
field = data.get("key_id", None)
292298
if field is not None:
@@ -311,7 +317,7 @@ def unmarshal_ListAlgorithmsResponseAlgorithm(
311317
"Unmarshalling the type 'ListAlgorithmsResponseAlgorithm' failed as data isn't a dictionary."
312318
)
313319

314-
args: Dict[str, Any] = {}
320+
args: dict[str, Any] = {}
315321

316322
field = data.get("usage", None)
317323
if field is not None:
@@ -340,7 +346,7 @@ def unmarshal_ListAlgorithmsResponse(data: Any) -> ListAlgorithmsResponse:
340346
"Unmarshalling the type 'ListAlgorithmsResponse' failed as data isn't a dictionary."
341347
)
342348

343-
args: Dict[str, Any] = {}
349+
args: dict[str, Any] = {}
344350

345351
field = data.get("algorithms", None)
346352
if field is not None:
@@ -361,7 +367,7 @@ def unmarshal_ListKeysResponse(data: Any) -> ListKeysResponse:
361367
"Unmarshalling the type 'ListKeysResponse' failed as data isn't a dictionary."
362368
)
363369

364-
args: Dict[str, Any] = {}
370+
args: dict[str, Any] = {}
365371

366372
field = data.get("keys", None)
367373
if field is not None:
@@ -384,7 +390,7 @@ def unmarshal_PublicKey(data: Any) -> PublicKey:
384390
"Unmarshalling the type 'PublicKey' failed as data isn't a dictionary."
385391
)
386392

387-
args: Dict[str, Any] = {}
393+
args: dict[str, Any] = {}
388394

389395
field = data.get("pem", None)
390396
if field is not None:
@@ -401,7 +407,7 @@ def unmarshal_SignResponse(data: Any) -> SignResponse:
401407
"Unmarshalling the type 'SignResponse' failed as data isn't a dictionary."
402408
)
403409

404-
args: Dict[str, Any] = {}
410+
args: dict[str, Any] = {}
405411

406412
field = data.get("key_id", None)
407413
if field is not None:
@@ -424,7 +430,7 @@ def unmarshal_VerifyResponse(data: Any) -> VerifyResponse:
424430
"Unmarshalling the type 'VerifyResponse' failed as data isn't a dictionary."
425431
)
426432

427-
args: Dict[str, Any] = {}
433+
args: dict[str, Any] = {}
428434

429435
field = data.get("key_id", None)
430436
if field is not None:
@@ -444,8 +450,8 @@ def unmarshal_VerifyResponse(data: Any) -> VerifyResponse:
444450
def marshal_KeyRotationPolicy(
445451
request: KeyRotationPolicy,
446452
defaults: ProfileDefaults,
447-
) -> Dict[str, Any]:
448-
output: Dict[str, Any] = {}
453+
) -> dict[str, Any]:
454+
output: dict[str, Any] = {}
449455

450456
if request.rotation_period is not None:
451457
output["rotation_period"] = request.rotation_period
@@ -459,8 +465,8 @@ def marshal_KeyRotationPolicy(
459465
def marshal_KeyUsage(
460466
request: KeyUsage,
461467
defaults: ProfileDefaults,
462-
) -> Dict[str, Any]:
463-
output: Dict[str, Any] = {}
468+
) -> dict[str, Any]:
469+
output: dict[str, Any] = {}
464470
output.update(
465471
resolve_one_of(
466472
[
@@ -489,8 +495,8 @@ def marshal_KeyUsage(
489495
def marshal_CreateKeyRequest(
490496
request: CreateKeyRequest,
491497
defaults: ProfileDefaults,
492-
) -> Dict[str, Any]:
493-
output: Dict[str, Any] = {}
498+
) -> dict[str, Any]:
499+
output: dict[str, Any] = {}
494500

495501
if request.unprotected is not None:
496502
output["unprotected"] = request.unprotected
@@ -526,8 +532,8 @@ def marshal_CreateKeyRequest(
526532
def marshal_DecryptRequest(
527533
request: DecryptRequest,
528534
defaults: ProfileDefaults,
529-
) -> Dict[str, Any]:
530-
output: Dict[str, Any] = {}
535+
) -> dict[str, Any]:
536+
output: dict[str, Any] = {}
531537

532538
if request.ciphertext is not None:
533539
output["ciphertext"] = request.ciphertext
@@ -541,8 +547,8 @@ def marshal_DecryptRequest(
541547
def marshal_EncryptRequest(
542548
request: EncryptRequest,
543549
defaults: ProfileDefaults,
544-
) -> Dict[str, Any]:
545-
output: Dict[str, Any] = {}
550+
) -> dict[str, Any]:
551+
output: dict[str, Any] = {}
546552

547553
if request.plaintext is not None:
548554
output["plaintext"] = request.plaintext
@@ -556,8 +562,8 @@ def marshal_EncryptRequest(
556562
def marshal_GenerateDataKeyRequest(
557563
request: GenerateDataKeyRequest,
558564
defaults: ProfileDefaults,
559-
) -> Dict[str, Any]:
560-
output: Dict[str, Any] = {}
565+
) -> dict[str, Any]:
566+
output: dict[str, Any] = {}
561567

562568
if request.without_plaintext is not None:
563569
output["without_plaintext"] = request.without_plaintext
@@ -571,8 +577,8 @@ def marshal_GenerateDataKeyRequest(
571577
def marshal_ImportKeyMaterialRequest(
572578
request: ImportKeyMaterialRequest,
573579
defaults: ProfileDefaults,
574-
) -> Dict[str, Any]:
575-
output: Dict[str, Any] = {}
580+
) -> dict[str, Any]:
581+
output: dict[str, Any] = {}
576582

577583
if request.key_material is not None:
578584
output["key_material"] = request.key_material
@@ -586,8 +592,8 @@ def marshal_ImportKeyMaterialRequest(
586592
def marshal_SignRequest(
587593
request: SignRequest,
588594
defaults: ProfileDefaults,
589-
) -> Dict[str, Any]:
590-
output: Dict[str, Any] = {}
595+
) -> dict[str, Any]:
596+
output: dict[str, Any] = {}
591597

592598
if request.digest is not None:
593599
output["digest"] = request.digest
@@ -598,8 +604,8 @@ def marshal_SignRequest(
598604
def marshal_UpdateKeyRequest(
599605
request: UpdateKeyRequest,
600606
defaults: ProfileDefaults,
601-
) -> Dict[str, Any]:
602-
output: Dict[str, Any] = {}
607+
) -> dict[str, Any]:
608+
output: dict[str, Any] = {}
603609

604610
if request.name is not None:
605611
output["name"] = request.name
@@ -621,8 +627,8 @@ def marshal_UpdateKeyRequest(
621627
def marshal_VerifyRequest(
622628
request: VerifyRequest,
623629
defaults: ProfileDefaults,
624-
) -> Dict[str, Any]:
625-
output: Dict[str, Any] = {}
630+
) -> dict[str, Any]:
631+
output: dict[str, Any] = {}
626632

627633
if request.digest is not None:
628634
output["digest"] = request.digest

0 commit comments

Comments
 (0)