Skip to content
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] Bump firewall sdk's api version to 2020-05-01 #1861

Merged
merged 6 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/azure-firewall/azext_firewall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from .profiles import CUSTOM_FIREWALL, CUSTOM_FIREWALL_POLICY
register_resource_type('latest', CUSTOM_FIREWALL, '2019-11-01')
register_resource_type('latest', CUSTOM_FIREWALL_POLICY, '2019-07-01')
register_resource_type('latest', CUSTOM_FIREWALL_POLICY, '2020-05-01')

super(AzureFirewallCommandsLoader, self).__init__(
cli_ctx=cli_ctx,
Expand Down
6 changes: 3 additions & 3 deletions src/azure-firewall/azext_firewall/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def network_client_policy_factory(cli_ctx, aux_subscriptions=None, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from .profiles import CUSTOM_FIREWALL_POLICY
return get_mgmt_service_client(cli_ctx, CUSTOM_FIREWALL_POLICY, aux_subscriptions=aux_subscriptions,
api_version='2019-07-01')
api_version='2020-05-01')


def cf_firewalls(cli_ctx, _):
Expand All @@ -30,5 +30,5 @@ def cf_firewall_policies(cli_ctx, _):
return network_client_policy_factory(cli_ctx).firewall_policies


def cf_firewall_policy_rule_groups(cli_ctx, _):
return network_client_policy_factory(cli_ctx).firewall_policy_rule_groups
def cf_firewall_policy_rule_collection_groups(cli_ctx, _):
return network_client_policy_factory(cli_ctx).firewall_policy_rule_collection_groups
8 changes: 4 additions & 4 deletions src/azure-firewall/azext_firewall/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ def load_arguments(self, _):

with self.argument_context('network firewall policy rule-collection-group') as c:
c.argument('firewall_policy_name', options_list=['--policy-name'], help='The name of the Firewall Policy.')
c.argument('rule_group_name', options_list=['--name', '-n'], help='The name of the Firewall Policy Rule Collection Group.')
c.argument('rule_collection_group_name', options_list=['--name', '-n'], help='The name of the Firewall Policy Rule Collection Group.')
c.argument('priority', type=int, help='Priority of the Firewall Policy Rule Collection Group')

with self.argument_context('network firewall policy rule-collection-group collection') as c:
c.argument('rule_group_name', options_list=['--rule-collection-group-name'], help='The name of the Firewall Policy Rule Collection Group.')
c.argument('rule_name', options_list=['--name', '-n'], help='The name of the collection in Firewall Policy Rule Collection Group.')
c.argument('rule_collection_group_name', options_list=['--rule-collection-group-name'], help='The name of the Firewall Policy Rule Collection Group.')
Copy link
Contributor

Choose a reason for hiding this comment

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

why change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't change the UX for customers. rule_group_name is the old name. rule_collection_group_name is the new name.

c.argument('rule_collection_name', options_list=['--name', '-n'], help='The name of the collection in Firewall Policy Rule Collection Group.')
c.argument('rule_priority', options_list=['--collection-priority'], type=int, help='The priority of the rule in Firewall Policy Rule Collection Group')
c.argument('description', arg_group='Common Rule', help='The description of rule.')
c.argument('destination_addresses', arg_group='Common Rule', nargs='+', help="Space-separated list of destination IP addresses.")
Expand All @@ -176,6 +176,6 @@ def load_arguments(self, _):
c.argument('nat_action', options_list=['--action'], arg_type=get_enum_type(['DNAT', 'SNAT']), help='The action type of a rule collection.')

with self.argument_context('network firewall policy rule-collection-group collection rule') as c:
c.argument('rule_name', options_list=['--collection-name'], help='The name of the rule collection in Firewall Policy Rule Collection Group.')
c.argument('rule_collection_name', options_list=['--collection-name'], help='The name of the rule collection in Firewall Policy Rule Collection Group.')
c.argument('condition_name', options_list=['--name', '-n'], arg_group='Common Rule', help='The name of rule')
# endregion
24 changes: 12 additions & 12 deletions src/azure-firewall/azext_firewall/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .custom import build_af_rule_list, build_af_rule_show, build_af_rule_delete
from .profiles import CUSTOM_FIREWALL_POLICY

from ._client_factory import cf_firewalls, cf_firewall_fqdn_tags, cf_firewall_policies, cf_firewall_policy_rule_groups
from ._client_factory import cf_firewalls, cf_firewall_fqdn_tags, cf_firewall_policies, cf_firewall_policy_rule_collection_groups
from ._util import (
list_network_resource_property, get_network_resource_property_entry, delete_network_resource_property_entry)

Expand Down Expand Up @@ -37,15 +37,15 @@ def load_command_table(self, _):
)

network_firewall_policies_sdk = CliCommandType(
operations_tmpl='azext_firewall.vendored_sdks.v2019_07_01.operations#FirewallPoliciesOperations.{}',
operations_tmpl='azext_firewall.vendored_sdks.v2020_05_01.operations#FirewallPoliciesOperations.{}',
client_factory=cf_firewall_policies,
resource_type=CUSTOM_FIREWALL_POLICY,
min_api='2019-07-01'
)

network_firewall_policy_rule_groups = CliCommandType(
operations_tmpl='azext_firewall.vendored_sdks.v2019_07_01.operations#FirewallPolicyRuleGroupsOperations.{}',
client_factory=cf_firewall_policy_rule_groups,
operations_tmpl='azext_firewall.vendored_sdks.v2020_05_01.operations#FirewallPolicyRuleCollectionGroupsOperations.{}',
client_factory=cf_firewall_policy_rule_collection_groups,
resource_type=CUSTOM_FIREWALL_POLICY,
min_api='2019-07-01'
)
Expand Down Expand Up @@ -119,19 +119,19 @@ def load_command_table(self, _):
g.generic_update_command('update', custom_func_name='update_azure_firewall_policies')

with self.command_group('network firewall policy rule-collection-group', network_firewall_policy_rule_groups, resource_type=CUSTOM_FIREWALL_POLICY, is_preview=True) as g:
g.custom_command('create', 'create_azure_firewall_policy_rule_group')
g.generic_update_command('update', custom_func_name='update_azure_firewall_policy_rule_group')
g.custom_command('create', 'create_azure_firewall_policy_rule_collection_group')
g.generic_update_command('update', custom_func_name='update_azure_firewall_policy_rule_collection_group')
g.command('delete', 'delete')
g.show_command('show')
g.command('list', 'list')

with self.command_group('network firewall policy rule-collection-group collection', network_firewall_policy_rule_groups, resource_type=CUSTOM_FIREWALL_POLICY, is_preview=True) as g:
g.custom_command('add-nat-collection', 'add_azure_firewall_policy_nat_rule')
g.custom_command('add-filter-collection', 'add_azure_firewall_policy_filter_rule')
g.custom_command('remove', 'remove_azure_firewall_policy_rule')
g.custom_command('list', 'list_azure_firewall_policy_rule')
g.custom_command('add-nat-collection', 'add_azure_firewall_policy_nat_rule_collection')
g.custom_command('add-filter-collection', 'add_azure_firewall_policy_filter_rule_collection')
g.custom_command('remove', 'remove_azure_firewall_policy_rule_collection')
g.custom_command('list', 'list_azure_firewall_policy_rule_collection')

with self.command_group('network firewall policy rule-collection-group collection rule', network_firewall_policy_rule_groups, resource_type=CUSTOM_FIREWALL_POLICY, is_preview=True) as g:
g.custom_command('add', 'add_azure_firewall_policy_filter_rule_condition')
g.custom_command('remove', 'remove_azure_firewall_policy_filter_rule_condition')
g.custom_command('add', 'add_azure_firewall_policy_filter_rule')
g.custom_command('remove', 'remove_azure_firewall_policy_filter_rule')
# endregion
Loading