Skip to content

Conversation

@arrownj
Copy link
Contributor

@arrownj arrownj commented Apr 17, 2020

Description
This PR is try to enable local context feature for vnet/subnet.

We will save vnet/subnet value to local context in create command and use these values in update, show and some other commands. One exception is for delete command. For delete command, user still need to specify vnet or subnet name even if local context is turned on.

Testing Guide
az network vnet create -g RG -n vnetName --subnet-name subnetName
az network vnet show
az network vnet subnet show
az network vnet subnet delete (prompt error)
az network vnet delete (prompt error)
az network vnet subnet delete -n subnetName
az network vnet delete -n vnetName

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 feature.


This checklist is used to make sure that common guidelines for a pull request are followed.

@arrownj arrownj requested a review from mmyyrroonn April 17, 2020 02:11
@arrownj arrownj requested a review from haroldrandom as a code owner April 17, 2020 02:11
@arrownj arrownj self-assigned this Apr 17, 2020
@arrownj arrownj requested a review from yungezz April 17, 2020 02:14
subnet_name_type = CLIArgumentType(options_list='--subnet-name', metavar='NAME', help='The subnet name.')
virtual_network_name_type = CLIArgumentType(options_list='--vnet-name', metavar='NAME', help='The virtual network (VNet) name.', completer=get_resource_name_completion_list('Microsoft.Network/virtualNetworks'),
local_context_attribute=LocalContextAttribute(name='vnet_name', actions=[GET]))
subnet_name_type = CLIArgumentType(options_list='--subnet-name', metavar='NAME', help='The subnet name.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we better not set default value for subnet_name. Several commands have to have specific subnet name which is defined as the default value in the custom function. Meanwhile, we used c.ignore to hide this value from customers. Will they be overwritten by local context?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double confirmed the logic. Should be fine.

@arrownj arrownj merged commit 28eb9a1 into Azure:dev Apr 17, 2020
@arrownj arrownj deleted the local_context_for_vnet branch July 29, 2020 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants