-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{Network} az network dns record-set
: Migrate commands to codegen v2
#26036
Conversation
️✔️acr
️✔️acs
️✔️advisor
️✔️ams
️✔️apim
️✔️appconfig
️✔️appservice
️✔️aro
️✔️backup
️✔️batch
️✔️batchai
️✔️billing
️✔️botservice
️✔️cdn
️✔️cloud
️✔️cognitiveservices
️✔️config
️✔️configure
️✔️consumption
️✔️container
️✔️core
️✔️cosmosdb
️✔️databoxedge
️✔️dla
️✔️dls
️✔️dms
️✔️eventgrid
️✔️eventhubs
️✔️feedback
️✔️find
️✔️hdinsight
️✔️identity
️✔️iot
️✔️keyvault
️✔️kusto
️✔️lab
️✔️managedservices
️✔️maps
️✔️marketplaceordering
️✔️monitor
️✔️netappfiles
️✔️network
️✔️policyinsights
️✔️privatedns
️✔️profile
️✔️rdbms
️✔️redis
️✔️relay
️✔️resource
️✔️role
️✔️search
️✔️security
️✔️servicebus
️✔️serviceconnector
️✔️servicefabric
️✔️signalr
️✔️sql
️✔️sqlvm
️✔️storage
️✔️synapse
️✔️telemetry
️✔️util
️✔️vm
|
Network |
record_set = dict() | ||
record_set["ttl"] = ret.get("TTL", None) | ||
record_set[record_snake] = ret.get(record_camel, None) | ||
record_set = _convert_to_snake_case(record_set) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need convert to snack case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think AAZCommands can auto parse camel case argument key automatically.
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_field_type.py
Lines 180 to 183 in efc8487
# if key is not found convert camel case key to snack case key | |
key = to_snack_case(key) | |
if key in self._fields: | |
return key |
def _convert_to_snake_case(element): | ||
if isinstance(element, dict): | ||
ret = dict() | ||
for k, v in element.items(): | ||
ret[_to_snake(k)] = _convert_to_snake_case(v) | ||
|
||
return ret | ||
|
||
if isinstance(element, list): | ||
return [_convert_to_snake_case(i) for i in element] | ||
|
||
return element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the element contains property like tags
? This will change the key from camel case to snack case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no properties like that, all properties are used for checking:
azure-cli/src/azure-cli/azure/cli/command_modules/network/custom.py
Lines 2985 to 3045 in 478f69c
def _check_a_record_exist(record, exist_list): | |
for r in exist_list: | |
if r["ipv4_address"] == record["ipv4_address"]: | |
return True | |
return False | |
def _check_aaaa_record_exist(record, exist_list): | |
for r in exist_list: | |
if r["ipv6_address"] == record["ipv6_address"]: | |
return True | |
return False | |
def _check_caa_record_exist(record, exist_list): | |
for r in exist_list: | |
if (r["flags"], r["tag"], r["value"]) == (record["flags"], record["tag"], record["value"]): | |
return True | |
return False | |
def _check_cname_record_exist(record, exist_list): | |
for r in exist_list: | |
if r["cname"] == record["cname"]: | |
return True | |
return False | |
def _check_mx_record_exist(record, exist_list): | |
for r in exist_list: | |
if (r["preference"], r["exchange"]) == (record["preference"], record["exchange"]): | |
return True | |
return False | |
def _check_ns_record_exist(record, exist_list): | |
for r in exist_list: | |
if r["nsdname"] == record["nsdname"]: | |
return True | |
return False | |
def _check_ptr_record_exist(record, exist_list): | |
for r in exist_list: | |
if r["ptrdname"] == record["ptrdname"]: | |
return True | |
return False | |
def _check_srv_record_exist(record, exist_list): | |
for r in exist_list: | |
if (r["priority"], r["weight"], r["port"], r["target"]) == (record["priority"], record["weight"], record["port"], record["target"]): | |
return True | |
return False | |
def _check_txt_record_exist(record, exist_list): | |
for r in exist_list: | |
if r["value"] == record["value"]: | |
return True | |
return False |
Related command
Description
Total: 47 commands
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a
: Make some customer-facing breaking change[Component Name 2]
az command b
: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.