Skip to content

Commit ea55ac6

Browse files
author
Yalin Li
authored
[KV-keys]Name change in SKR (Azure#21609)
1 parent 7136504 commit ea55ac6

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def create_key(self, name, key_type, **kwargs):
130130

131131
policy = kwargs.pop("release_policy", None)
132132
if policy is not None:
133-
policy = self._models.KeyReleasePolicy(data=policy.data, content_type=policy.content_type)
133+
policy = self._models.KeyReleasePolicy(data=policy.encoded_policy, content_type=policy.content_type)
134134
parameters = self._models.KeyCreateParameters(
135135
kty=key_type,
136136
key_size=kwargs.pop("size", None),
@@ -559,7 +559,7 @@ def update_key_properties(self, name, version=None, **kwargs):
559559

560560
policy = kwargs.pop("release_policy", None)
561561
if policy is not None:
562-
policy = self._models.KeyReleasePolicy(content_type=policy.content_type, data=policy.data)
562+
policy = self._models.KeyReleasePolicy(content_type=policy.content_type, data=policy.encoded_policy)
563563
parameters = self._models.KeyUpdateParameters(
564564
key_ops=kwargs.pop("key_operations", None),
565565
key_attributes=attributes,
@@ -676,7 +676,7 @@ def import_key(self, name, key, **kwargs):
676676

677677
policy = kwargs.pop("release_policy", None)
678678
if policy is not None:
679-
policy = self._models.KeyReleasePolicy(content_type=policy.content_type, data=policy.data)
679+
policy = self._models.KeyReleasePolicy(content_type=policy.content_type, data=policy.encoded_policy)
680680
parameters = self._models.KeyImportParameters(
681681
key=key._to_generated_model(),
682682
key_attributes=attributes,
@@ -695,15 +695,15 @@ def import_key(self, name, key, **kwargs):
695695
return KeyVaultKey._from_key_bundle(bundle)
696696

697697
@distributed_trace
698-
def release_key(self, name, target, version=None, **kwargs):
698+
def release_key(self, name, target_attestation_token, version=None, **kwargs):
699699
# type: (str, str, Optional[str], **Any) -> ReleaseKeyResult
700700
"""Releases a key.
701701
702702
The release key operation is applicable to all key types. The target key must be marked
703703
exportable. This operation requires the keys/release permission.
704704
705705
:param str name: The name of the key to get.
706-
:param str target: The attestation assertion for the target of the key release.
706+
:param str target_attestation_token: The attestation assertion for the target of the key release.
707707
:param str version: (optional) A specific version of the key to release. If unspecified, the latest version is
708708
released.
709709
@@ -720,7 +720,7 @@ def release_key(self, name, target, version=None, **kwargs):
720720
key_name=name,
721721
key_version=version or "",
722722
parameters=self._models.KeyReleaseParameters(
723-
target=target, nonce=kwargs.pop("nonce", None), enc=kwargs.pop("algorithm", None)
723+
target=target_attestation_token, nonce=kwargs.pop("nonce", None), enc=kwargs.pop("algorithm", None)
724724
),
725725
**kwargs
726726
)

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class KeyReleasePolicy(object):
264264

265265
def __init__(self, data, **kwargs):
266266
# type: (bytes, **Any) -> None
267-
self.data = data
267+
self.encoded_policy = data
268268
self.content_type = kwargs.get("content_type", None)
269269

270270

sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/aio/_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ async def create_key(self, name: str, key_type: "Union[str, KeyType]", **kwargs:
129129

130130
policy = kwargs.pop("release_policy", None)
131131
if policy is not None:
132-
policy = self._models.KeyReleasePolicy(data=policy.data, content_type=policy.content_type)
132+
policy = self._models.KeyReleasePolicy(data=policy.encoded_policy, content_type=policy.content_type)
133133
parameters = self._models.KeyCreateParameters(
134134
kty=key_type,
135135
key_size=kwargs.pop("size", None),
@@ -540,7 +540,7 @@ async def update_key_properties(self, name: str, version: "Optional[str]" = None
540540

541541
policy = kwargs.pop("release_policy", None)
542542
if policy is not None:
543-
policy = self._models.KeyReleasePolicy(content_type=policy.content_type, data=policy.data)
543+
policy = self._models.KeyReleasePolicy(content_type=policy.content_type, data=policy.encoded_policy)
544544
parameters = self._models.KeyUpdateParameters(
545545
key_ops=kwargs.pop("key_operations", None),
546546
key_attributes=attributes,
@@ -654,7 +654,7 @@ async def import_key(self, name: str, key: JsonWebKey, **kwargs: "Any") -> KeyVa
654654

655655
policy = kwargs.pop("release_policy", None)
656656
if policy is not None:
657-
policy = self._models.KeyReleasePolicy(content_type=policy.content_type, data=policy.data)
657+
policy = self._models.KeyReleasePolicy(content_type=policy.content_type, data=policy.encoded_policy)
658658
parameters = self._models.KeyImportParameters(
659659
key=key._to_generated_model(),
660660
key_attributes=attributes,
@@ -674,15 +674,15 @@ async def import_key(self, name: str, key: JsonWebKey, **kwargs: "Any") -> KeyVa
674674

675675
@distributed_trace_async
676676
async def release_key(
677-
self, name: str, target: str, version: "Optional[str]" = None, **kwargs: "Any"
677+
self, name: str, target_attestation_token: str, version: "Optional[str]" = None, **kwargs: "Any"
678678
) -> ReleaseKeyResult:
679679
"""Releases a key.
680680
681681
The release key operation is applicable to all key types. The target key must be marked
682682
exportable. This operation requires the keys/release permission.
683683
684684
:param str name: The name of the key to get.
685-
:param str target: The attestation assertion for the target of the key release.
685+
:param str target_attestation_token: The attestation assertion for the target of the key release.
686686
:param str version: (optional) A specific version of the key to release. If unspecified, the latest version is
687687
released.
688688
@@ -699,7 +699,7 @@ async def release_key(
699699
key_name=name,
700700
key_version=version or "",
701701
parameters=self._models.KeyReleaseParameters(
702-
target=target, nonce=kwargs.pop("nonce", None), enc=kwargs.pop("algorithm", None)
702+
target=target_attestation_token, nonce=kwargs.pop("nonce", None), enc=kwargs.pop("algorithm", None)
703703
),
704704
**kwargs
705705
)

sdk/keyvault/azure-keyvault-keys/tests/test_key_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def _update_key_properties(self, client, key, release_policy=None):
141141
assert key.properties.updated_on != key_bundle.properties.updated_on
142142
assert sorted(key_ops) == sorted(key_bundle.key_operations)
143143
if release_policy:
144-
assert key.properties.release_policy.data != key_bundle.properties.release_policy.data
144+
assert key.properties.release_policy.encoded_policy != key_bundle.properties.release_policy.encoded_policy
145145
return key_bundle
146146

147147
def _import_test_key(self, client, name, hardware_protected=False, **kwargs):
@@ -500,7 +500,7 @@ def test_key_release(self, client, **kwargs):
500500
client, rsa_key_name, hardware_protected=True, exportable=True, release_policy=release_policy
501501
)
502502
assert key.properties.release_policy
503-
assert key.properties.release_policy.data
503+
assert key.properties.release_policy.encoded_policy
504504
assert key.properties.exportable
505505

506506
release_result = client.release_key(rsa_key_name, attestation)
@@ -518,7 +518,7 @@ def test_imported_key_release(self, client, **kwargs):
518518
client, imported_key_name, hardware_protected=True, exportable=True, release_policy=release_policy
519519
)
520520
assert key.properties.release_policy
521-
assert key.properties.release_policy.data
521+
assert key.properties.release_policy.encoded_policy
522522
assert key.properties.exportable
523523

524524
release_result = client.release_key(imported_key_name, attestation)
@@ -533,7 +533,7 @@ def test_update_release_policy(self, client, **kwargs):
533533
key = self._create_rsa_key(
534534
client, key_name, hardware_protected=True, exportable=True, release_policy=release_policy
535535
)
536-
assert key.properties.release_policy.data
536+
assert key.properties.release_policy.encoded_policy
537537

538538
new_release_policy_json = {
539539
"anyOf": [

sdk/keyvault/azure-keyvault-keys/tests/test_keys_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ async def _update_key_properties(self, client, key, release_policy=None):
128128
assert key.properties.updated_on != key_bundle.properties.updated_on
129129
assert sorted(key_ops) == sorted(key_bundle.key_operations)
130130
if release_policy:
131-
assert key.properties.release_policy.data != key_bundle.properties.release_policy.data
131+
assert key.properties.release_policy.encoded_policy != key_bundle.properties.release_policy.encoded_policy
132132
return key_bundle
133133

134134
async def _validate_key_list(self, keys, expected):
@@ -497,7 +497,7 @@ async def test_key_release(self, client, **kwargs):
497497
client, rsa_key_name, hardware_protected=True, exportable=True, release_policy=release_policy
498498
)
499499
assert key.properties.release_policy
500-
assert key.properties.release_policy.data
500+
assert key.properties.release_policy.encoded_policy
501501
assert key.properties.exportable
502502

503503
release_result = await client.release_key(rsa_key_name, attestation)
@@ -515,7 +515,7 @@ async def test_imported_key_release(self, client, **kwargs):
515515
client, imported_key_name, hardware_protected=True, exportable=True, release_policy=release_policy
516516
)
517517
assert key.properties.release_policy
518-
assert key.properties.release_policy.data
518+
assert key.properties.release_policy.encoded_policy
519519
assert key.properties.exportable
520520

521521
release_result = await client.release_key(imported_key_name, attestation)
@@ -530,7 +530,7 @@ async def test_update_release_policy(self, client, **kwargs):
530530
key = await self._create_rsa_key(
531531
client, key_name, hardware_protected=True, exportable=True, release_policy=release_policy
532532
)
533-
assert key.properties.release_policy.data
533+
assert key.properties.release_policy.encoded_policy
534534

535535
new_release_policy_json = {
536536
"anyOf": [

0 commit comments

Comments
 (0)