-
Notifications
You must be signed in to change notification settings - Fork 3k
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] Migrate network to track2 SDK #16245
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,7 +172,12 @@ def _resolve_model(self): | |
|
||
doc_string = doc_string.replace('\r', '').replace('\n', ' ') | ||
doc_string = re.sub(' +', ' ', doc_string) | ||
model_name_regex = re.compile(r':return: (.*that returns )?(?P<model>[a-zA-Z]*)') | ||
|
||
# pylint: disable=line-too-long | ||
# In track1, the doc_string for return type is like ':return: An instance of LROPoller that returns ConnectionSharedKey or ClientRawResponse<ConnectionSharedKey>' | ||
# In track2, the doc_string for return type is like ':return: An instance of LROPoller that returns either ConnectionSharedKey or the result of cls(response)' | ||
# Add '(?:either )?' to match 'either' zero or one times to support track2. | ||
model_name_regex = re.compile(r':return: (?:.*?that returns (?:either )?)?(?P<model>[a-zA-Z]*)') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is dark magic. Consider adding more comments. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. Originally I added comments, it seems when I resolved conflicts manually after rebasing dev, the comments was removed accidentally. I'll add comments here to explain why this change happened. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could add more annotation or example? The regex is not clear. |
||
model_path_regex = re.compile(r':rtype:.*(?P<path>azure.mgmt[a-zA-Z0-9_\.]*)') | ||
try: | ||
self._model_name = model_name_regex.search(doc_string).group('model') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -899,7 +899,7 @@ def load_arguments(self, _): | |
c.argument('floating_ip', help='Enable floating IP.', arg_type=get_three_state_flag()) | ||
c.argument('idle_timeout', help='Idle timeout in minutes.', type=int) | ||
c.argument('protocol', help='Network transport protocol.', arg_type=get_enum_type(TransportProtocol)) | ||
c.argument('private_ip_address_version', min_api='2019-04-01', help='The private IP address version to use.', default=IPVersion.ipv4.value if IPVersion else '') | ||
c.argument('private_ip_address_version', min_api='2019-04-01', help='The private IP address version to use.', default=IPVersion.I_PV4.value if IPVersion else '') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. name change by track2 SDK. |
||
for item in ['backend_pool_name', 'backend_address_pool_name']: | ||
c.argument(item, options_list='--backend-pool-name', help='The name of the backend address pool.', completer=get_lb_subresource_completion_list('backend_address_pools')) | ||
|
||
|
@@ -1089,7 +1089,7 @@ def load_arguments(self, _): | |
c.argument('enable_ip_forwarding', options_list='--ip-forwarding', help='Enable IP forwarding.', arg_type=get_three_state_flag()) | ||
|
||
with self.argument_context('network nic create') as c: | ||
c.argument('private_ip_address_version', min_api='2016-09-01', help='The private IP address version to use.', default=IPVersion.ipv4.value if IPVersion else '') | ||
c.argument('private_ip_address_version', min_api='2016-09-01', help='The private IP address version to use.', default=IPVersion.I_PV4.value if IPVersion else '') | ||
c.argument('network_interface_name', nic_type, options_list=['--name', '-n'], id_part=None) | ||
|
||
public_ip_help = get_folded_parameter_help_string('public IP address', allow_none=True, default_none=True) | ||
|
@@ -1924,7 +1924,8 @@ def load_arguments(self, _): | |
with self.argument_context('network vpn-connection shared-key') as c: | ||
c.argument('connection_shared_key_name', options_list=['--name', '-n'], id_part='name') | ||
c.argument('virtual_network_gateway_connection_name', options_list='--connection-name', metavar='NAME', id_part='name') | ||
c.argument('key_length', type=int) | ||
c.argument('key_length', type=int, help='The virtual network connection reset shared key length, should between 1 and 128.') | ||
c.argument('value', help='The virtual network connection shared key value.') | ||
|
||
with self.argument_context('network vrouter') as c: | ||
c.argument('virtual_router_name', options_list=['--name', '-n'], help='The name of the Virtual Router.') | ||
|
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.
Add package here to pass CI.