你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

KeysOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

KeyVaultManagementClient's

<xref:keys> attribute.

Constructor

KeysOperations(*args, **kwargs)

Methods

create_if_not_exist

Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys.

get

Gets the current version of the specified key from the specified key vault.

get_version

Gets the specified version of the specified key in the specified key vault.

list

Lists the keys in the specified key vault.

list_versions

Lists the keys in the specified key vault.

create_if_not_exist

Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys.

create_if_not_exist(resource_group_name: str, vault_name: str, key_name: str, parameters: _models.KeyCreateParameters, *, content_type: str = 'application/json', **kwargs: Any) -> _models.Key

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

vault_name
Required
str

The name of the vault which contains the key to be retrieved. Required.

key_name
Required
str

The name of the key to be retrieved. Required.

parameters
Required
KeyCreateParameters or <xref:JSON> or IO[bytes]

The parameters used to create the specified key. Is one of the following types: KeyCreateParameters, JSON, IO[bytes] Required.

Returns

Type Description
Key

Key. The Key is compatible with MutableMapping

Exceptions

Type Description

get

Gets the current version of the specified key from the specified key vault.

get(resource_group_name: str, vault_name: str, key_name: str, **kwargs: Any) -> Key

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

vault_name
Required
str

The name of the vault which contains the key to be retrieved. Required.

key_name
Required
str

The name of the key to be retrieved. Required.

Returns

Type Description
Key

Key. The Key is compatible with MutableMapping

Exceptions

Type Description

get_version

Gets the specified version of the specified key in the specified key vault.

get_version(resource_group_name: str, vault_name: str, key_name: str, key_version: str, **kwargs: Any) -> Key

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

vault_name
Required
str

The name of the vault which contains the key version to be retrieved. Required.

key_name
Required
str

The name of the key version to be retrieved. Required.

key_version
Required
str

The version of the key to be retrieved. Required.

Returns

Type Description
Key

Key. The Key is compatible with MutableMapping

Exceptions

Type Description

list

Lists the keys in the specified key vault.

list(resource_group_name: str, vault_name: str, **kwargs: Any) -> ItemPaged[Key]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

vault_name
Required
str

The name of the vault which contains the key to be retrieved. Required.

Returns

Type Description

An iterator like instance of Key

Exceptions

Type Description

list_versions

Lists the keys in the specified key vault.

list_versions(resource_group_name: str, vault_name: str, key_name: str, **kwargs: Any) -> ItemPaged[Key]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group. The name is case insensitive. Required.

vault_name
Required
str

The name of the vault which contains the key version to be retrieved. Required.

key_name
Required
str

The name of the key version to be retrieved. Required.

Returns

Type Description

An iterator like instance of Key

Exceptions

Type Description