aaz-dev-tools icon indicating copy to clipboard operation
aaz-dev-tools copied to clipboard

CLI - Array of object feature request

Open schaudhari6254888 opened this issue 2 years ago • 0 comments

CLI - Array of object feature request The multiple addition/deletion feature is not supported by the aaz-dev-tool subcommand's current version. That is, when I use a subcommand to construct, for example, az eventhubs namespace encryption add, we can only add one encryption attribute at a time.

Therefore, in order to avoid this, we have built custom code. For example, I added the cli_add_encryption method. https://github.com/schaudhari6254888/azure-cli/blob/cccd800d7c631dbc33e9710719bfe6a3ea142fb1/src/azure-cli/azure/cli/command_modules/eventhubs/operations/namespace_custom.py#L90

However, if we can construct this Array of objects using a tool, for example, look at this swagger file.

https://github.com/schaudhari6254888/azure-rest-api-specs/blob/6c6b16dc98d720304633b76c8e82c282ffa9cc08/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/namespaces-preview.json#L915

keyVaultProperties is an array of objects containing keyName, keyVaultURI, KeyVersion, and Identity. So the encryption add subcommand should take this keyVaultProperties as an array of objects, allowing us to handle multiple addition of encryption for the add subcommand.

Similarly, for the delete subcommand operation, we may use x-ms-identifier=['properties/keyVaultProperties'] to identify the deletion to be done on keyVaultProperties only.

for ex - az eventhubs namespace encryption remove --resource-group {rg} --namespace-name {namespacename} --encryption-config key-name={key2} key-vault-uri={key_uri} user-assigned-identity={id1} --encryption-config key-name={key3} key-vault-uri={key_uri} user-assigned-identity={id1}

This way, we can simplify the subcommands and avoid future custom code.

schaudhari6254888 avatar Jun 28 '23 09:06 schaudhari6254888