-
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] Add new commands to manage flow-log and deprecate old configure command #12350
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e9f3e05
Init command: watcher flow-log create
de655bb
Init command: watcher flow-log list
020ba1c
Init command: watcher flow-log delete
1a7726f
Add deprecate info to flow-log configure
fc3dc06
Fix missing client_factory when creating flow log
66ddc4d
Update command: watcher flow-log show
e68c120
Update command: watcher flow-log update
f3f18ad
test_nw_flow_log_create
2c23c57
test_nw_flow_log_delete
fa70fd2
test_nw_flow_log_show
dc1cd48
Change default vaule of --enable to true
c1c05b5
test_nw_flow_log_update
369ea7d
remove --storage-account-id
b61df69
typo
3903194
remove unnecessary parameter group
00b5057
Expose --location and remove --watcher for identify Network Watcher
3cb7cb5
Update help and fix style error
f366a87
Add help examples
b80c2df
Add message in help to warn user the location restriction
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
cf_express_route_circuit_connections, cf_express_route_gateways, cf_express_route_connections, | ||
cf_express_route_ports, cf_express_route_port_locations, cf_express_route_links, cf_app_gateway_waf_policy, | ||
cf_service_tags, cf_private_link_services, cf_private_endpoint_types, cf_peer_express_route_circuit_connections, | ||
cf_virtual_router, cf_virtual_router_peering, cf_service_aliases, cf_bastion_hosts) | ||
cf_virtual_router, cf_virtual_router_peering, cf_service_aliases, cf_bastion_hosts, cf_flow_logs) | ||
from azure.cli.command_modules.network._util import ( | ||
list_network_resource_property, get_network_resource_property_entry, delete_network_resource_property_entry) | ||
from azure.cli.command_modules.network._format import ( | ||
|
@@ -43,14 +43,15 @@ | |
transform_vnet_table_output, transform_effective_route_table, transform_effective_nsg, | ||
transform_vnet_gateway_routes_table, transform_vnet_gateway_bgp_peer_table) | ||
from azure.cli.command_modules.network._validators import ( | ||
get_network_watcher_from_location, | ||
process_ag_create_namespace, process_ag_listener_create_namespace, process_ag_http_settings_create_namespace, | ||
process_ag_rule_create_namespace, process_ag_ssl_policy_set_namespace, process_ag_url_path_map_create_namespace, | ||
process_ag_url_path_map_rule_create_namespace, process_auth_create_namespace, process_nic_create_namespace, | ||
process_lb_create_namespace, process_lb_frontend_ip_namespace, process_local_gateway_create_namespace, | ||
process_nw_cm_create_namespace, | ||
process_nw_cm_v2_endpoint_namespace, process_nw_cm_v2_test_configuration_namespace, | ||
process_nw_cm_v2_test_group, process_nw_cm_v2_output_namespace, | ||
process_nw_flow_log_set_namespace, process_nw_flow_log_show_namespace, | ||
process_nw_flow_log_set_namespace, process_nw_flow_log_create_namespace, process_nw_flow_log_show_namespace, | ||
process_nw_packet_capture_create_namespace, process_nw_test_connectivity_namespace, process_nw_topology_namespace, | ||
process_nw_troubleshooting_start_namespace, process_nw_troubleshooting_show_namespace, | ||
process_public_ip_create_namespace, process_tm_endpoint_create_namespace, | ||
|
@@ -300,6 +301,16 @@ def load_command_table(self, _): | |
client_factory=cf_connection_monitor | ||
) | ||
|
||
network_watcher_flow_log_sdk = CliCommandType( | ||
operations_tmpl='azure.mgmt.network.operations#FlowLogsOperations.{}', | ||
client_factory=cf_flow_logs, | ||
) | ||
|
||
network_watcher_flow_log_update_sdk = CliCommandType( | ||
operations_tmpl='azure.cli.command_modules.network.custom#{}', | ||
client_factory=cf_flow_logs, | ||
) | ||
|
||
network_watcher_pc_sdk = CliCommandType( | ||
operations_tmpl='azure.mgmt.network.operations#PacketCapturesOperations.{}', | ||
client_factory=cf_packet_capture | ||
|
@@ -910,9 +921,31 @@ def _make_singular(value): | |
g.command('list', 'list') | ||
|
||
with self.command_group('network watcher flow-log', client_factory=cf_network_watcher, min_api='2016-09-01') as g: | ||
g.custom_command('configure', 'set_nsg_flow_logging', validator=process_nw_flow_log_set_namespace) | ||
g.custom_command('configure', | ||
'set_nsg_flow_logging', | ||
validator=process_nw_flow_log_set_namespace, | ||
deprecate_info=self.deprecate(redirect='network watcher flow-log create', hide=False)) | ||
g.custom_show_command('show', 'show_nsg_flow_logging', validator=process_nw_flow_log_show_namespace) | ||
|
||
with self.command_group('network watcher flow-log', | ||
network_watcher_flow_log_sdk, | ||
client_factory=cf_flow_logs, | ||
min_api='2019-11-01', | ||
validator=get_network_watcher_from_location(remove=False)) as g: | ||
g.custom_command('list', 'list_nw_flow_log', validator=get_network_watcher_from_location(remove=False)) | ||
g.custom_command('delete', 'delete_nw_flow_log', validator=get_network_watcher_from_location(remove=False)) | ||
g.custom_command('create', | ||
'create_nw_flow_log', | ||
client_factory=cf_flow_logs, | ||
validator=process_nw_flow_log_create_namespace) | ||
g.generic_update_command('update', | ||
getter_name='update_nw_flow_log_getter', | ||
getter_type=network_watcher_flow_log_update_sdk, | ||
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. why do we need this one? 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. Answered in next question. |
||
setter_name='update_nw_flow_log_setter', | ||
setter_type=network_watcher_flow_log_update_sdk, | ||
custom_func_name='update_nw_flow_log', | ||
validator=process_nw_flow_log_create_namespace) | ||
|
||
with self.command_group('network watcher troubleshooting', client_factory=cf_network_watcher, min_api='2016-09-01') as g: | ||
g.custom_command('start', 'start_nw_troubleshooting', supports_no_wait=True, validator=process_nw_troubleshooting_start_namespace) | ||
g.custom_show_command('show', 'show_nw_troubleshooting_result', validator=process_nw_troubleshooting_show_namespace) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
a little bit confusing to me. What's the meaning of
Azure Resource Management formatted
?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 am not sure. Just want user to know the output is different from the older one. Any suggestion to do this?