Skip to content
Open
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
11 changes: 11 additions & 0 deletions src/azure-cli/azure/cli/command_modules/network/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -6244,3 +6244,14 @@
--resource-type vpnConnection --storage-account MyStorageAccount \\
--storage-path https://{storageAccountName}.blob.core.windows.net/{containerName}
"""

helps['network ddos-custom-policy create'] = """
type: command
short-summary: Create a DDoS custom policy.
examples:
- name: Create DDoS custom policy
text: |
az network ddos-custom-policy create --resource-group rg1 --ddos-custom-policy-name test-ddos-custom-policy \\
--location centraluseuap --detection-rule-name detectionRuleTcp \\
--detection-mode TrafficThreshold --traffic-type Tcp --packets-per-second 1000000
"""
11 changes: 11 additions & 0 deletions src/azure-cli/azure/cli/command_modules/network/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,3 +843,14 @@ def load_arguments(self, _):
c.argument('resource_group_name', required=False)
c.argument('resource_name', required=False, help='Name of the resource')
# endregion

# region DdosCustomPolicy
with self.argument_context('network ddos-custom-policy create') as c:
c.argument('ddos_custom_policy_name', options_list=['--ddos-custom-policy-name', '--name', '-n'], help='The name of the DDoS custom policy.')
c.argument('location', arg_group='Parameters', help='Resource location.')
c.argument('tags', arg_group='Parameters', help='Resource tags.')
c.argument('detection_rule_name', arg_group='Detection Rules', help='The name of the DDoS detection rule.')
c.argument('detection_mode', arg_group='Detection Rules', help='The detection mode for the DDoS detection rule.')
c.argument('traffic_type', arg_group='Detection Rules', help='The traffic type (one of Tcp, Udp, TcpSyn) that the detection rule will be applied upon.')
c.argument('packets_per_second', arg_group='Detection Rules', help='The customized packets per second threshold.')
# endregion
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,34 @@ def build_vpn_connection_resource(cmd, name, location, tags, gateway1, gateway2,
'properties': vpn_properties if vpn_type != 'VpnClient' else {}
}
return vpn_connection


def build_ddos_custom_policy(cmd, ddos_custom_policy_name, location=None, tags=None, detection_rule_name=None,
detection_mode=None, packets_per_second=None, traffic_type=None):
policy = {'ddos_custom_policy_name': ddos_custom_policy_name}

if location:
policy['location'] = location

if tags:
policy['tags'] = tags

detection_rules = {}
traffic_detection_rule = {}

if detection_rule_name:
detection_rules['name'] = detection_rule_name

if detection_mode:
detection_rules['detection_mode'] = detection_mode

if packets_per_second:
traffic_detection_rule['packets_per_second'] = packets_per_second

if traffic_type:
traffic_detection_rule['traffic_type'] = traffic_type

detection_rules['traffic_detection_rule'] = traffic_detection_rule
policy['detection_rules'] = [detection_rules]

return policy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"network ddos-custom-policy",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Ddos Custom Policy
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._create import *
from ._delete import *
from ._show import *
from ._update import *
from ._wait import *
Loading