Skip to content

Commit

Permalink
[KeyVault] az keyvault key create: add a new value import for param…
Browse files Browse the repository at this point in the history
…eter `--ops` (#12030)
  • Loading branch information
bim-msft authored Feb 4, 2020
1 parent 2d58a35 commit 4769cb9
Show file tree
Hide file tree
Showing 3 changed files with 599 additions and 168 deletions.
15 changes: 14 additions & 1 deletion src/azure-cli/azure/cli/command_modules/keyvault/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from enum import Enum

from argcomplete.completers import FilesCompleter

Expand Down Expand Up @@ -41,6 +42,17 @@ def load_arguments(self, _):
'SasDefinitionAttributes', 'SecretAttributes', 'CertificateAttributes', 'StorageAccountAttributes',
resource_type=ResourceType.DATA_KEYVAULT)

class CLIJsonWebKeyOperation(str, Enum):
encrypt = "encrypt"
decrypt = "decrypt"
sign = "sign"
verify = "verify"
wrap_key = "wrapKey"
unwrap_key = "unwrapKey"
import_ = "import"

JsonWebKeyOperation = CLIJsonWebKeyOperation # TODO: Remove this patch when new SDK is released

(SkuName, KeyPermissions, SecretPermissions, CertificatePermissions, StoragePermissions,
NetworkRuleBypassOptions, NetworkRuleAction) = self.get_models(
'SkuName', 'KeyPermissions', 'SecretPermissions', 'CertificatePermissions', 'StoragePermissions',
Expand Down Expand Up @@ -138,7 +150,8 @@ def load_arguments(self, _):

# region keys
with self.argument_context('keyvault key') as c:
c.argument('key_ops', arg_type=get_enum_type(JsonWebKeyOperation), options_list=['--ops'], nargs='*', help='Space-separated list of permitted JSON web key operations.')
c.argument('key_ops', arg_type=get_enum_type(JsonWebKeyOperation), options_list=['--ops'], nargs='*',
help='Space-separated list of permitted JSON web key operations.')

for scope in ['keyvault key create', 'keyvault key import']:
with self.argument_context(scope) as c:
Expand Down
Loading

0 comments on commit 4769cb9

Please sign in to comment.