CLI - Array of object feature request

Open
#262 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli, tooling

Research direction

Start with the aaz-dev-tool subcommand behavior and compare it with the linked cli_add_encryption method in src/azure-cli/azure/cli/command_modules/eventhubs/operations/namespace_custom.py. Review the keyVaultProperties definition in namespaces-preview.json, then determine how add and remove should accept multiple objects. Done means both operations support repeated encryption configurations without custom code.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
27
Forks
77
Avg merge
1d 20h
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/aaz-dev-tools

All issues in Azure/aaz-dev-tools

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.