From 4a6c65ffbfd916e0ac2a593849f52938e8d81caf Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sun, 16 Dec 2018 12:03:26 +0000 Subject: [PATCH 01/11] Generated from 20052694d510f2c464e56ffce47eb8570e9bd065 Added missing NorthSouthResourceName parameter definition --- .../azure/mgmt/security/models/__init__.py | 18 ++ .../security/models/north_south_hardenings.py | 59 +++++ .../models/north_south_hardenings_paged.py | 27 ++ .../models/north_south_hardenings_py3.py | 59 +++++ .../security/models/security_center_enums.py | 12 + .../mgmt/security/models/traffic_alert.py | 47 ++++ .../mgmt/security/models/traffic_alert_py3.py | 47 ++++ .../models/traffic_alert_traffic_item.py | 34 +++ .../models/traffic_alert_traffic_item_py3.py | 34 +++ .../security/models/traffic_hardening_rule.py | 49 ++++ .../models/traffic_hardening_rule_py3.py | 49 ++++ .../mgmt/security/operations/__init__.py | 2 + .../north_south_hardenings_operations.py | 243 ++++++++++++++++++ .../azure/mgmt/security/security_center.py | 5 + 14 files changed, 685 insertions(+) create mode 100644 azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_paged.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py diff --git a/azure-mgmt-security/azure/mgmt/security/models/__init__.py b/azure-mgmt-security/azure/mgmt/security/models/__init__.py index 47bdff08e273..50a3bc19394b 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/models/__init__.py @@ -60,6 +60,10 @@ from .external_security_solution_kind1_py3 import ExternalSecuritySolutionKind1 from .external_security_solution_properties_py3 import ExternalSecuritySolutionProperties from .aad_connectivity_state1_py3 import AadConnectivityState1 + from .traffic_hardening_rule_py3 import TrafficHardeningRule + from .traffic_alert_traffic_item_py3 import TrafficAlertTrafficItem + from .traffic_alert_py3 import TrafficAlert + from .north_south_hardenings_py3 import NorthSouthHardenings from .connected_resource_py3 import ConnectedResource from .connectable_resource_py3 import ConnectableResource from .allowed_connections_resource_py3 import AllowedConnectionsResource @@ -114,6 +118,10 @@ from .external_security_solution_kind1 import ExternalSecuritySolutionKind1 from .external_security_solution_properties import ExternalSecuritySolutionProperties from .aad_connectivity_state1 import AadConnectivityState1 + from .traffic_hardening_rule import TrafficHardeningRule + from .traffic_alert_traffic_item import TrafficAlertTrafficItem + from .traffic_alert import TrafficAlert + from .north_south_hardenings import NorthSouthHardenings from .connected_resource import ConnectedResource from .connectable_resource import ConnectableResource from .allowed_connections_resource import AllowedConnectionsResource @@ -131,6 +139,7 @@ from .discovered_security_solution_paged import DiscoveredSecuritySolutionPaged from .jit_network_access_policy_paged import JitNetworkAccessPolicyPaged from .external_security_solution_paged import ExternalSecuritySolutionPaged +from .north_south_hardenings_paged import NorthSouthHardeningsPaged from .topology_resource_paged import TopologyResourcePaged from .allowed_connections_resource_paged import AllowedConnectionsResourcePaged from .security_center_enums import ( @@ -145,6 +154,8 @@ StatusReason, AadConnectivityState, ExternalSecuritySolutionKind, + NorthSouthProtocol, + NorthSouthTrafficDirection, ConnectionType, ) @@ -199,6 +210,10 @@ 'ExternalSecuritySolutionKind1', 'ExternalSecuritySolutionProperties', 'AadConnectivityState1', + 'TrafficHardeningRule', + 'TrafficAlertTrafficItem', + 'TrafficAlert', + 'NorthSouthHardenings', 'ConnectedResource', 'ConnectableResource', 'AllowedConnectionsResource', @@ -216,6 +231,7 @@ 'DiscoveredSecuritySolutionPaged', 'JitNetworkAccessPolicyPaged', 'ExternalSecuritySolutionPaged', + 'NorthSouthHardeningsPaged', 'TopologyResourcePaged', 'AllowedConnectionsResourcePaged', 'AlertNotifications', @@ -229,5 +245,7 @@ 'StatusReason', 'AadConnectivityState', 'ExternalSecuritySolutionKind', + 'NorthSouthProtocol', + 'NorthSouthTrafficDirection', 'ConnectionType', ] diff --git a/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings.py b/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings.py new file mode 100644 index 000000000000..a64dbed022a1 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class NorthSouthHardenings(Resource): + """The resource whose properties describes the North-south hardening settings + for some Azure resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param traffic_hardening_rules: The set of North-south traffic hardening + rules + :type traffic_hardening_rules: + list[~azure.mgmt.security.models.TrafficHardeningRule] + :param traffic_alerts: The set of North-south hardening alerts associated + with the Azure resource + :type traffic_alerts: list[~azure.mgmt.security.models.TrafficAlert] + :param rules_calculation_time: The UTC time on which the traffic hardening + rules were calculated + :type rules_calculation_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'traffic_hardening_rules': {'key': 'properties.trafficHardeningRules', 'type': '[TrafficHardeningRule]'}, + 'traffic_alerts': {'key': 'properties.trafficAlerts', 'type': '[TrafficAlert]'}, + 'rules_calculation_time': {'key': 'properties.rulesCalculationTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(NorthSouthHardenings, self).__init__(**kwargs) + self.traffic_hardening_rules = kwargs.get('traffic_hardening_rules', None) + self.traffic_alerts = kwargs.get('traffic_alerts', None) + self.rules_calculation_time = kwargs.get('rules_calculation_time', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_paged.py b/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_paged.py new file mode 100644 index 000000000000..f1207dc1d828 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class NorthSouthHardeningsPaged(Paged): + """ + A paging container for iterating over a list of :class:`NorthSouthHardenings ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[NorthSouthHardenings]'} + } + + def __init__(self, *args, **kwargs): + + super(NorthSouthHardeningsPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_py3.py b/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_py3.py new file mode 100644 index 000000000000..406680c0763d --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_py3.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource_py3 import Resource + + +class NorthSouthHardenings(Resource): + """The resource whose properties describes the North-south hardening settings + for some Azure resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param traffic_hardening_rules: The set of North-south traffic hardening + rules + :type traffic_hardening_rules: + list[~azure.mgmt.security.models.TrafficHardeningRule] + :param traffic_alerts: The set of North-south hardening alerts associated + with the Azure resource + :type traffic_alerts: list[~azure.mgmt.security.models.TrafficAlert] + :param rules_calculation_time: The UTC time on which the traffic hardening + rules were calculated + :type rules_calculation_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'traffic_hardening_rules': {'key': 'properties.trafficHardeningRules', 'type': '[TrafficHardeningRule]'}, + 'traffic_alerts': {'key': 'properties.trafficAlerts', 'type': '[TrafficAlert]'}, + 'rules_calculation_time': {'key': 'properties.rulesCalculationTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, traffic_hardening_rules=None, traffic_alerts=None, rules_calculation_time=None, **kwargs) -> None: + super(NorthSouthHardenings, self).__init__(**kwargs) + self.traffic_hardening_rules = traffic_hardening_rules + self.traffic_alerts = traffic_alerts + self.rules_calculation_time = rules_calculation_time diff --git a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py index 951d2c9525c7..bbc78a78cc99 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py +++ b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py @@ -83,6 +83,18 @@ class ExternalSecuritySolutionKind(str, Enum): aad = "AAD" +class NorthSouthProtocol(str, Enum): + + tcp = "TCP" + udp = "UDP" + + +class NorthSouthTrafficDirection(str, Enum): + + inbound = "Inbound" + outbound = "Outbound" + + class ConnectionType(str, Enum): internal = "Internal" diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py new file mode 100644 index 000000000000..a5701645c80e --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TrafficAlert(Model): + """A north-south traffic hardening alert. + + :param detection_date: the date (UTC) that the traffic was detected + :type detection_date: datetime + :param direction: The alert's traffic direction. Possible values include: + 'Inbound', 'Outbound' + :type direction: str or + ~azure.mgmt.security.models.NorthSouthTrafficDirection + :param destination_port: The alert's deStination port + :type destination_port: int + :param protocol: The alert's transport protocol. Possible values include: + 'TCP', 'UDP' + :type protocol: str or ~azure.mgmt.security.models.NorthSouthProtocol + :param traffic: The traffic that was detected and raised the alert + :type traffic: list[~azure.mgmt.security.models.TrafficAlertTrafficItem] + """ + + _attribute_map = { + 'detection_date': {'key': 'detectionDate', 'type': 'iso-8601'}, + 'direction': {'key': 'direction', 'type': 'str'}, + 'destination_port': {'key': 'destinationPort', 'type': 'int'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'traffic': {'key': 'traffic', 'type': '[TrafficAlertTrafficItem]'}, + } + + def __init__(self, **kwargs): + super(TrafficAlert, self).__init__(**kwargs) + self.detection_date = kwargs.get('detection_date', None) + self.direction = kwargs.get('direction', None) + self.destination_port = kwargs.get('destination_port', None) + self.protocol = kwargs.get('protocol', None) + self.traffic = kwargs.get('traffic', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py new file mode 100644 index 000000000000..dfd09efa00e6 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TrafficAlert(Model): + """A north-south traffic hardening alert. + + :param detection_date: the date (UTC) that the traffic was detected + :type detection_date: datetime + :param direction: The alert's traffic direction. Possible values include: + 'Inbound', 'Outbound' + :type direction: str or + ~azure.mgmt.security.models.NorthSouthTrafficDirection + :param destination_port: The alert's deStination port + :type destination_port: int + :param protocol: The alert's transport protocol. Possible values include: + 'TCP', 'UDP' + :type protocol: str or ~azure.mgmt.security.models.NorthSouthProtocol + :param traffic: The traffic that was detected and raised the alert + :type traffic: list[~azure.mgmt.security.models.TrafficAlertTrafficItem] + """ + + _attribute_map = { + 'detection_date': {'key': 'detectionDate', 'type': 'iso-8601'}, + 'direction': {'key': 'direction', 'type': 'str'}, + 'destination_port': {'key': 'destinationPort', 'type': 'int'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'traffic': {'key': 'traffic', 'type': '[TrafficAlertTrafficItem]'}, + } + + def __init__(self, *, detection_date=None, direction=None, destination_port: int=None, protocol=None, traffic=None, **kwargs) -> None: + super(TrafficAlert, self).__init__(**kwargs) + self.detection_date = detection_date + self.direction = direction + self.destination_port = destination_port + self.protocol = protocol + self.traffic = traffic diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item.py new file mode 100644 index 000000000000..3f492a3817fb --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TrafficAlertTrafficItem(Model): + """TrafficAlertTrafficItem. + + :param remote_address: The IP address of the remote host that is + associated with the traffic + :type remote_address: str + :param attempts: The detected number of packets sent to or from the remote + address (depends on the direction of the traffic) + :type attempts: float + """ + + _attribute_map = { + 'remote_address': {'key': 'remoteAddress', 'type': 'str'}, + 'attempts': {'key': 'attempts', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(TrafficAlertTrafficItem, self).__init__(**kwargs) + self.remote_address = kwargs.get('remote_address', None) + self.attempts = kwargs.get('attempts', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item_py3.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item_py3.py new file mode 100644 index 000000000000..10d9d2e1efce --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item_py3.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TrafficAlertTrafficItem(Model): + """TrafficAlertTrafficItem. + + :param remote_address: The IP address of the remote host that is + associated with the traffic + :type remote_address: str + :param attempts: The detected number of packets sent to or from the remote + address (depends on the direction of the traffic) + :type attempts: float + """ + + _attribute_map = { + 'remote_address': {'key': 'remoteAddress', 'type': 'str'}, + 'attempts': {'key': 'attempts', 'type': 'float'}, + } + + def __init__(self, *, remote_address: str=None, attempts: float=None, **kwargs) -> None: + super(TrafficAlertTrafficItem, self).__init__(**kwargs) + self.remote_address = remote_address + self.attempts = attempts diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule.py new file mode 100644 index 000000000000..5726333c1e0e --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TrafficHardeningRule(Model): + """A north-south traffic hardening rule. + + :param name: The name of the rule + :type name: str + :param direction: The rule;s traffic direction. Possible values include: + 'Inbound', 'Outbound' + :type direction: str or + ~azure.mgmt.security.models.NorthSouthTrafficDirection + :param destination_port: The rule's destination port + :type destination_port: int + :param protocols: The rule's transport protocol + :type protocols: list[str or + ~azure.mgmt.security.models.NorthSouthProtocol] + :param allow_remote_addresses: The remote addresses that should be able to + communicate with the Azure resource on the rule's destination port and + protocol + :type allow_remote_addresses: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'direction': {'key': 'direction', 'type': 'str'}, + 'destination_port': {'key': 'destinationPort', 'type': 'int'}, + 'protocols': {'key': 'protocols', 'type': '[str]'}, + 'allow_remote_addresses': {'key': 'allowRemoteAddresses', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(TrafficHardeningRule, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.direction = kwargs.get('direction', None) + self.destination_port = kwargs.get('destination_port', None) + self.protocols = kwargs.get('protocols', None) + self.allow_remote_addresses = kwargs.get('allow_remote_addresses', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule_py3.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule_py3.py new file mode 100644 index 000000000000..afdb62a266b9 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule_py3.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TrafficHardeningRule(Model): + """A north-south traffic hardening rule. + + :param name: The name of the rule + :type name: str + :param direction: The rule;s traffic direction. Possible values include: + 'Inbound', 'Outbound' + :type direction: str or + ~azure.mgmt.security.models.NorthSouthTrafficDirection + :param destination_port: The rule's destination port + :type destination_port: int + :param protocols: The rule's transport protocol + :type protocols: list[str or + ~azure.mgmt.security.models.NorthSouthProtocol] + :param allow_remote_addresses: The remote addresses that should be able to + communicate with the Azure resource on the rule's destination port and + protocol + :type allow_remote_addresses: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'direction': {'key': 'direction', 'type': 'str'}, + 'destination_port': {'key': 'destinationPort', 'type': 'int'}, + 'protocols': {'key': 'protocols', 'type': '[str]'}, + 'allow_remote_addresses': {'key': 'allowRemoteAddresses', 'type': '[str]'}, + } + + def __init__(self, *, name: str=None, direction=None, destination_port: int=None, protocols=None, allow_remote_addresses=None, **kwargs) -> None: + super(TrafficHardeningRule, self).__init__(**kwargs) + self.name = name + self.direction = direction + self.destination_port = destination_port + self.protocols = protocols + self.allow_remote_addresses = allow_remote_addresses diff --git a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py index cc451ba3dd54..2faf3be20310 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py @@ -24,6 +24,7 @@ from .discovered_security_solutions_operations import DiscoveredSecuritySolutionsOperations from .jit_network_access_policies_operations import JitNetworkAccessPoliciesOperations from .external_security_solutions_operations import ExternalSecuritySolutionsOperations +from .north_south_hardenings_operations import NorthSouthHardeningsOperations from .topology_operations import TopologyOperations from .allowed_connections_operations import AllowedConnectionsOperations @@ -43,6 +44,7 @@ 'DiscoveredSecuritySolutionsOperations', 'JitNetworkAccessPoliciesOperations', 'ExternalSecuritySolutionsOperations', + 'NorthSouthHardeningsOperations', 'TopologyOperations', 'AllowedConnectionsOperations', ] diff --git a/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py new file mode 100644 index 000000000000..971228883f6d --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py @@ -0,0 +1,243 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class NorthSouthHardeningsOperations(object): + """NorthSouthHardeningsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: API version for the operation. Constant value: "2015-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-06-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets a list of north-south hardening resources for the subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of NorthSouthHardenings + :rtype: + ~azure.mgmt.security.models.NorthSouthHardeningsPaged[~azure.mgmt.security.models.NorthSouthHardenings] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.NorthSouthHardeningsPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.NorthSouthHardeningsPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/northSouthHardenings'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of north-south hardening resources for the resource group. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of NorthSouthHardenings + :rtype: + ~azure.mgmt.security.models.NorthSouthHardeningsPaged[~azure.mgmt.security.models.NorthSouthHardenings] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.NorthSouthHardeningsPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.NorthSouthHardeningsPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/northSouthHardenings'} + + def get( + self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, north_south_resource_name, custom_headers=None, raw=False, **operation_config): + """Gets the north-south traffic hardening for the specified resource. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param extended_resource_provider: Resource provider name of the base + resource + :type extended_resource_provider: str + :param extended_resource_type: Type of the base resource + :type extended_resource_type: str + :param extended_resource_name: The name of the base resource + :type extended_resource_name: str + :param north_south_resource_name: Name of a north-south resource. + :type north_south_resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NorthSouthHardenings or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.NorthSouthHardenings or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'extendedResourceProvider': self._serialize.url("extended_resource_provider", extended_resource_provider, 'str'), + 'extendedResourceType': self._serialize.url("extended_resource_type", extended_resource_type, 'str'), + 'extendedResourceName': self._serialize.url("extended_resource_name", extended_resource_name, 'str'), + 'northSouthResourceName': self._serialize.url("north_south_resource_name", north_south_resource_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NorthSouthHardenings', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/northSouthHardenings/{northSouthResourceName}'} diff --git a/azure-mgmt-security/azure/mgmt/security/security_center.py b/azure-mgmt-security/azure/mgmt/security/security_center.py index 4a70b5762f4f..2d3f21f20f05 100644 --- a/azure-mgmt-security/azure/mgmt/security/security_center.py +++ b/azure-mgmt-security/azure/mgmt/security/security_center.py @@ -28,6 +28,7 @@ from .operations.discovered_security_solutions_operations import DiscoveredSecuritySolutionsOperations from .operations.jit_network_access_policies_operations import JitNetworkAccessPoliciesOperations from .operations.external_security_solutions_operations import ExternalSecuritySolutionsOperations +from .operations.north_south_hardenings_operations import NorthSouthHardeningsOperations from .operations.topology_operations import TopologyOperations from .operations.allowed_connections_operations import AllowedConnectionsOperations from . import models @@ -107,6 +108,8 @@ class SecurityCenter(SDKClient): :vartype jit_network_access_policies: azure.mgmt.security.operations.JitNetworkAccessPoliciesOperations :ivar external_security_solutions: ExternalSecuritySolutions operations :vartype external_security_solutions: azure.mgmt.security.operations.ExternalSecuritySolutionsOperations + :ivar north_south_hardenings: NorthSouthHardenings operations + :vartype north_south_hardenings: azure.mgmt.security.operations.NorthSouthHardeningsOperations :ivar topology: Topology operations :vartype topology: azure.mgmt.security.operations.TopologyOperations :ivar allowed_connections: AllowedConnections operations @@ -163,6 +166,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.external_security_solutions = ExternalSecuritySolutionsOperations( self._client, self.config, self._serialize, self._deserialize) + self.north_south_hardenings = NorthSouthHardeningsOperations( + self._client, self.config, self._serialize, self._deserialize) self.topology = TopologyOperations( self._client, self.config, self._serialize, self._deserialize) self.allowed_connections = AllowedConnectionsOperations( From 8355ed2e9a86239a05ed1408aa98754d05afe3b7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 17 Dec 2018 07:30:09 +0000 Subject: [PATCH 02/11] Generated from 6f1e5a96cfe2c9e0d91f508437a969e96ffbdf31 Fixed typos found in CR --- azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py | 2 +- .../azure/mgmt/security/models/traffic_alert_py3.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py index a5701645c80e..f8d0a082cbcc 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py +++ b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py @@ -21,7 +21,7 @@ class TrafficAlert(Model): 'Inbound', 'Outbound' :type direction: str or ~azure.mgmt.security.models.NorthSouthTrafficDirection - :param destination_port: The alert's deStination port + :param destination_port: The alert's destination port :type destination_port: int :param protocol: The alert's transport protocol. Possible values include: 'TCP', 'UDP' diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py index dfd09efa00e6..c68bb2132947 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py @@ -21,7 +21,7 @@ class TrafficAlert(Model): 'Inbound', 'Outbound' :type direction: str or ~azure.mgmt.security.models.NorthSouthTrafficDirection - :param destination_port: The alert's deStination port + :param destination_port: The alert's destination port :type destination_port: int :param protocol: The alert's transport protocol. Possible values include: 'TCP', 'UDP' From 7c4327c893946d3ebe4159a99d53854c9e6a493e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 17 Dec 2018 19:59:11 +0000 Subject: [PATCH 03/11] Generated from 65fea15aaca7910d8c26888a17c21b7d1ae6d2da Added EnforceTrafficHardeningRules action --- .../north_south_hardenings_operations.py | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py index 971228883f6d..772af8c292ec 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py @@ -24,6 +24,7 @@ class NorthSouthHardeningsOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar api_version: API version for the operation. Constant value: "2015-06-01-preview". + :ivar traffic_hardenings_rules_enforce_action: Enforces the given collections of traffic hardenings rule's on the VM's NSG. Constant value: "enforce". """ models = models @@ -34,6 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.api_version = "2015-06-01-preview" + self.traffic_hardenings_rules_enforce_action = "enforce" self.config = config @@ -241,3 +243,69 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/northSouthHardenings/{northSouthResourceName}'} + + def enforce( + self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, north_south_resource_name, custom_headers=None, raw=False, **operation_config): + """Enforces the given collections of traffic hardenings rule's on the VM's + NSG. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param extended_resource_provider: Resource provider name of the base + resource + :type extended_resource_provider: str + :param extended_resource_type: Type of the base resource + :type extended_resource_type: str + :param extended_resource_name: The name of the base resource + :type extended_resource_name: str + :param north_south_resource_name: Name of a north-south resource. + :type north_south_resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.enforce.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'extendedResourceProvider': self._serialize.url("extended_resource_provider", extended_resource_provider, 'str'), + 'extendedResourceType': self._serialize.url("extended_resource_type", extended_resource_type, 'str'), + 'extendedResourceName': self._serialize.url("extended_resource_name", extended_resource_name, 'str'), + 'northSouthResourceName': self._serialize.url("north_south_resource_name", north_south_resource_name, 'str'), + 'trafficHardeningsRulesEnforceAction': self._serialize.url("self.traffic_hardenings_rules_enforce_action", self.traffic_hardenings_rules_enforce_action, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + enforce.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/northSouthHardenings/{northSouthResourceName}/enforce'} From 4b3c2b392d627f46b72bb2de1b3fc564416582b7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 17 Dec 2018 20:10:29 +0000 Subject: [PATCH 04/11] Generated from a582baa04ecb149f0285144e2fcbbc178b6e2572 Fixed invalid action name in URI discovered by ARM validation tools (enforce to trafficHardeningsRulesEnforceAction) --- .../security/operations/north_south_hardenings_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py index 772af8c292ec..6c4ba10d06bb 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py @@ -308,4 +308,4 @@ def enforce( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - enforce.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/northSouthHardenings/{northSouthResourceName}/enforce'} + enforce.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/northSouthHardenings/{northSouthResourceName}/{trafficHardeningsRulesEnforceAction}'} From 62d9bb63c44a9c72fa313b6eef33acdddaea6092 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 15 Jan 2019 17:14:57 +0000 Subject: [PATCH 05/11] Generated from 84f9472e808a834dc84b3deedce468bf9f4f97da Moving 'x-ms-long-running-operation' to the right location --- .../azure/mgmt/security/models/__init__.py | 39 ++-- ...enings.py => adaptive_network_controls.py} | 34 +-- ...trols_effective_network_security_groups.py | 33 +++ ...s_effective_network_security_groups_py3.py | 33 +++ ....py => adaptive_network_controls_paged.py} | 8 +- ...y3.py => adaptive_network_controls_py3.py} | 36 +-- ...e.py => adaptive_network_controls_rule.py} | 25 ++- ... => adaptive_network_controls_rule_py3.py} | 27 +-- .../security/models/data_export_setting.py | 7 +- .../models/data_export_setting_py3.py | 11 +- .../security/models/security_center_enums.py | 13 +- .../azure/mgmt/security/models/setting.py | 21 +- .../mgmt/security/models/setting_kind1.py | 29 --- .../mgmt/security/models/setting_kind1_py3.py | 29 --- .../azure/mgmt/security/models/setting_py3.py | 25 +-- .../mgmt/security/models/setting_resource.py | 51 +++++ .../security/models/setting_resource_py3.py | 51 +++++ .../mgmt/security/models/traffic_alert.py | 47 ---- .../mgmt/security/models/traffic_alert_py3.py | 47 ---- .../models/traffic_alert_traffic_item.py | 34 --- .../models/traffic_alert_traffic_item_py3.py | 34 --- .../mgmt/security/operations/__init__.py | 4 +- ...> adaptive_network_controls_operations.py} | 212 ++++++++---------- .../operations/settings_operations.py | 18 +- .../azure/mgmt/security/security_center.py | 8 +- 25 files changed, 396 insertions(+), 480 deletions(-) rename azure-mgmt-security/azure/mgmt/security/models/{north_south_hardenings.py => adaptive_network_controls.py} (53%) create mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups_py3.py rename azure-mgmt-security/azure/mgmt/security/models/{north_south_hardenings_paged.py => adaptive_network_controls_paged.py} (65%) rename azure-mgmt-security/azure/mgmt/security/models/{north_south_hardenings_py3.py => adaptive_network_controls_py3.py} (50%) rename azure-mgmt-security/azure/mgmt/security/models/{traffic_hardening_rule.py => adaptive_network_controls_rule.py} (63%) rename azure-mgmt-security/azure/mgmt/security/models/{traffic_hardening_rule_py3.py => adaptive_network_controls_rule_py3.py} (60%) delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/setting_kind1.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/setting_kind1_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/setting_resource.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/setting_resource_py3.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item_py3.py rename azure-mgmt-security/azure/mgmt/security/operations/{north_south_hardenings_operations.py => adaptive_network_controls_operations.py} (62%) diff --git a/azure-mgmt-security/azure/mgmt/security/models/__init__.py b/azure-mgmt-security/azure/mgmt/security/models/__init__.py index 50a3bc19394b..43480334118a 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/models/__init__.py @@ -21,7 +21,7 @@ from .advanced_threat_protection_setting_py3 import AdvancedThreatProtectionSetting from .setting_py3 import Setting from .data_export_setting_py3 import DataExportSetting - from .setting_kind1_py3 import SettingKind1 + from .setting_resource_py3 import SettingResource from .sensitivity_label_py3 import SensitivityLabel from .information_protection_keyword_py3 import InformationProtectionKeyword from .information_type_py3 import InformationType @@ -60,10 +60,9 @@ from .external_security_solution_kind1_py3 import ExternalSecuritySolutionKind1 from .external_security_solution_properties_py3 import ExternalSecuritySolutionProperties from .aad_connectivity_state1_py3 import AadConnectivityState1 - from .traffic_hardening_rule_py3 import TrafficHardeningRule - from .traffic_alert_traffic_item_py3 import TrafficAlertTrafficItem - from .traffic_alert_py3 import TrafficAlert - from .north_south_hardenings_py3 import NorthSouthHardenings + from .adaptive_network_controls_rule_py3 import AdaptiveNetworkControlsRule + from .adaptive_network_controls_effective_network_security_groups_py3 import AdaptiveNetworkControlsEffectiveNetworkSecurityGroups + from .adaptive_network_controls_py3 import AdaptiveNetworkControls from .connected_resource_py3 import ConnectedResource from .connectable_resource_py3 import ConnectableResource from .allowed_connections_resource_py3 import AllowedConnectionsResource @@ -79,7 +78,7 @@ from .advanced_threat_protection_setting import AdvancedThreatProtectionSetting from .setting import Setting from .data_export_setting import DataExportSetting - from .setting_kind1 import SettingKind1 + from .setting_resource import SettingResource from .sensitivity_label import SensitivityLabel from .information_protection_keyword import InformationProtectionKeyword from .information_type import InformationType @@ -118,10 +117,9 @@ from .external_security_solution_kind1 import ExternalSecuritySolutionKind1 from .external_security_solution_properties import ExternalSecuritySolutionProperties from .aad_connectivity_state1 import AadConnectivityState1 - from .traffic_hardening_rule import TrafficHardeningRule - from .traffic_alert_traffic_item import TrafficAlertTrafficItem - from .traffic_alert import TrafficAlert - from .north_south_hardenings import NorthSouthHardenings + from .adaptive_network_controls_rule import AdaptiveNetworkControlsRule + from .adaptive_network_controls_effective_network_security_groups import AdaptiveNetworkControlsEffectiveNetworkSecurityGroups + from .adaptive_network_controls import AdaptiveNetworkControls from .connected_resource import ConnectedResource from .connectable_resource import ConnectableResource from .allowed_connections_resource import AllowedConnectionsResource @@ -139,7 +137,7 @@ from .discovered_security_solution_paged import DiscoveredSecuritySolutionPaged from .jit_network_access_policy_paged import JitNetworkAccessPolicyPaged from .external_security_solution_paged import ExternalSecuritySolutionPaged -from .north_south_hardenings_paged import NorthSouthHardeningsPaged +from .adaptive_network_controls_paged import AdaptiveNetworkControlsPaged from .topology_resource_paged import TopologyResourcePaged from .allowed_connections_resource_paged import AllowedConnectionsResourcePaged from .security_center_enums import ( @@ -154,8 +152,8 @@ StatusReason, AadConnectivityState, ExternalSecuritySolutionKind, - NorthSouthProtocol, - NorthSouthTrafficDirection, + Direction, + TransportProtocol, ConnectionType, ) @@ -171,7 +169,7 @@ 'AdvancedThreatProtectionSetting', 'Setting', 'DataExportSetting', - 'SettingKind1', + 'SettingResource', 'SensitivityLabel', 'InformationProtectionKeyword', 'InformationType', @@ -210,10 +208,9 @@ 'ExternalSecuritySolutionKind1', 'ExternalSecuritySolutionProperties', 'AadConnectivityState1', - 'TrafficHardeningRule', - 'TrafficAlertTrafficItem', - 'TrafficAlert', - 'NorthSouthHardenings', + 'AdaptiveNetworkControlsRule', + 'AdaptiveNetworkControlsEffectiveNetworkSecurityGroups', + 'AdaptiveNetworkControls', 'ConnectedResource', 'ConnectableResource', 'AllowedConnectionsResource', @@ -231,7 +228,7 @@ 'DiscoveredSecuritySolutionPaged', 'JitNetworkAccessPolicyPaged', 'ExternalSecuritySolutionPaged', - 'NorthSouthHardeningsPaged', + 'AdaptiveNetworkControlsPaged', 'TopologyResourcePaged', 'AllowedConnectionsResourcePaged', 'AlertNotifications', @@ -245,7 +242,7 @@ 'StatusReason', 'AadConnectivityState', 'ExternalSecuritySolutionKind', - 'NorthSouthProtocol', - 'NorthSouthTrafficDirection', + 'Direction', + 'TransportProtocol', 'ConnectionType', ] diff --git a/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls.py similarity index 53% rename from azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings.py rename to azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls.py index a64dbed022a1..2834f76094a6 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings.py +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls.py @@ -12,9 +12,9 @@ from .resource import Resource -class NorthSouthHardenings(Resource): - """The resource whose properties describes the North-south hardening settings - for some Azure resource. +class AdaptiveNetworkControls(Resource): + """The resource whose properties describes the Adaptive Network Controls + settings for some Azure resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -25,16 +25,16 @@ class NorthSouthHardenings(Resource): :vartype name: str :ivar type: Resource type :vartype type: str - :param traffic_hardening_rules: The set of North-south traffic hardening - rules - :type traffic_hardening_rules: - list[~azure.mgmt.security.models.TrafficHardeningRule] - :param traffic_alerts: The set of North-south hardening alerts associated - with the Azure resource - :type traffic_alerts: list[~azure.mgmt.security.models.TrafficAlert] - :param rules_calculation_time: The UTC time on which the traffic hardening - rules were calculated + :param rules: The security rules which are recommended to be effective on + the VM + :type rules: list[~azure.mgmt.security.models.AdaptiveNetworkControlsRule] + :param rules_calculation_time: The UTC time on which the rules were + calculated :type rules_calculation_time: datetime + :param effective_network_security_groups: The Network Security Groups + effective on the network interfaces of the protected resource + :type effective_network_security_groups: + list[~azure.mgmt.security.models.AdaptiveNetworkControlsEffectiveNetworkSecurityGroups] """ _validation = { @@ -47,13 +47,13 @@ class NorthSouthHardenings(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'traffic_hardening_rules': {'key': 'properties.trafficHardeningRules', 'type': '[TrafficHardeningRule]'}, - 'traffic_alerts': {'key': 'properties.trafficAlerts', 'type': '[TrafficAlert]'}, + 'rules': {'key': 'properties.rules', 'type': '[AdaptiveNetworkControlsRule]'}, 'rules_calculation_time': {'key': 'properties.rulesCalculationTime', 'type': 'iso-8601'}, + 'effective_network_security_groups': {'key': 'properties.effectiveNetworkSecurityGroups', 'type': '[AdaptiveNetworkControlsEffectiveNetworkSecurityGroups]'}, } def __init__(self, **kwargs): - super(NorthSouthHardenings, self).__init__(**kwargs) - self.traffic_hardening_rules = kwargs.get('traffic_hardening_rules', None) - self.traffic_alerts = kwargs.get('traffic_alerts', None) + super(AdaptiveNetworkControls, self).__init__(**kwargs) + self.rules = kwargs.get('rules', None) self.rules_calculation_time = kwargs.get('rules_calculation_time', None) + self.effective_network_security_groups = kwargs.get('effective_network_security_groups', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups.py new file mode 100644 index 000000000000..25958f239461 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AdaptiveNetworkControlsEffectiveNetworkSecurityGroups(Model): + """Describes the Network Security Groups effective on a network interface. + + :param network_interface: The Azure resource ID of the network interface + :type network_interface: str + :param network_security_groups: The Network Security Groups effective on + the network interface + :type network_security_groups: list[str] + """ + + _attribute_map = { + 'network_interface': {'key': 'networkInterface', 'type': 'str'}, + 'network_security_groups': {'key': 'networkSecurityGroups', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(AdaptiveNetworkControlsEffectiveNetworkSecurityGroups, self).__init__(**kwargs) + self.network_interface = kwargs.get('network_interface', None) + self.network_security_groups = kwargs.get('network_security_groups', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups_py3.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups_py3.py new file mode 100644 index 000000000000..aa1defc37c82 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups_py3.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AdaptiveNetworkControlsEffectiveNetworkSecurityGroups(Model): + """Describes the Network Security Groups effective on a network interface. + + :param network_interface: The Azure resource ID of the network interface + :type network_interface: str + :param network_security_groups: The Network Security Groups effective on + the network interface + :type network_security_groups: list[str] + """ + + _attribute_map = { + 'network_interface': {'key': 'networkInterface', 'type': 'str'}, + 'network_security_groups': {'key': 'networkSecurityGroups', 'type': '[str]'}, + } + + def __init__(self, *, network_interface: str=None, network_security_groups=None, **kwargs) -> None: + super(AdaptiveNetworkControlsEffectiveNetworkSecurityGroups, self).__init__(**kwargs) + self.network_interface = network_interface + self.network_security_groups = network_security_groups diff --git a/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_paged.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_paged.py similarity index 65% rename from azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_paged.py rename to azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_paged.py index f1207dc1d828..3fe658a50233 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_paged.py +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class NorthSouthHardeningsPaged(Paged): +class AdaptiveNetworkControlsPaged(Paged): """ - A paging container for iterating over a list of :class:`NorthSouthHardenings ` object + A paging container for iterating over a list of :class:`AdaptiveNetworkControls ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[NorthSouthHardenings]'} + 'current_page': {'key': 'value', 'type': '[AdaptiveNetworkControls]'} } def __init__(self, *args, **kwargs): - super(NorthSouthHardeningsPaged, self).__init__(*args, **kwargs) + super(AdaptiveNetworkControlsPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_py3.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_py3.py similarity index 50% rename from azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_py3.py rename to azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_py3.py index 406680c0763d..23a6fa6e2865 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/north_south_hardenings_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_py3.py @@ -12,9 +12,9 @@ from .resource_py3 import Resource -class NorthSouthHardenings(Resource): - """The resource whose properties describes the North-south hardening settings - for some Azure resource. +class AdaptiveNetworkControls(Resource): + """The resource whose properties describes the Adaptive Network Controls + settings for some Azure resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -25,16 +25,16 @@ class NorthSouthHardenings(Resource): :vartype name: str :ivar type: Resource type :vartype type: str - :param traffic_hardening_rules: The set of North-south traffic hardening - rules - :type traffic_hardening_rules: - list[~azure.mgmt.security.models.TrafficHardeningRule] - :param traffic_alerts: The set of North-south hardening alerts associated - with the Azure resource - :type traffic_alerts: list[~azure.mgmt.security.models.TrafficAlert] - :param rules_calculation_time: The UTC time on which the traffic hardening - rules were calculated + :param rules: The security rules which are recommended to be effective on + the VM + :type rules: list[~azure.mgmt.security.models.AdaptiveNetworkControlsRule] + :param rules_calculation_time: The UTC time on which the rules were + calculated :type rules_calculation_time: datetime + :param effective_network_security_groups: The Network Security Groups + effective on the network interfaces of the protected resource + :type effective_network_security_groups: + list[~azure.mgmt.security.models.AdaptiveNetworkControlsEffectiveNetworkSecurityGroups] """ _validation = { @@ -47,13 +47,13 @@ class NorthSouthHardenings(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'traffic_hardening_rules': {'key': 'properties.trafficHardeningRules', 'type': '[TrafficHardeningRule]'}, - 'traffic_alerts': {'key': 'properties.trafficAlerts', 'type': '[TrafficAlert]'}, + 'rules': {'key': 'properties.rules', 'type': '[AdaptiveNetworkControlsRule]'}, 'rules_calculation_time': {'key': 'properties.rulesCalculationTime', 'type': 'iso-8601'}, + 'effective_network_security_groups': {'key': 'properties.effectiveNetworkSecurityGroups', 'type': '[AdaptiveNetworkControlsEffectiveNetworkSecurityGroups]'}, } - def __init__(self, *, traffic_hardening_rules=None, traffic_alerts=None, rules_calculation_time=None, **kwargs) -> None: - super(NorthSouthHardenings, self).__init__(**kwargs) - self.traffic_hardening_rules = traffic_hardening_rules - self.traffic_alerts = traffic_alerts + def __init__(self, *, rules=None, rules_calculation_time=None, effective_network_security_groups=None, **kwargs) -> None: + super(AdaptiveNetworkControls, self).__init__(**kwargs) + self.rules = rules self.rules_calculation_time = rules_calculation_time + self.effective_network_security_groups = effective_network_security_groups diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule.py similarity index 63% rename from azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule.py rename to azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule.py index 5726333c1e0e..4d9edd891960 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule.py +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule.py @@ -12,24 +12,25 @@ from msrest.serialization import Model -class TrafficHardeningRule(Model): - """A north-south traffic hardening rule. +class AdaptiveNetworkControlsRule(Model): + """Describes remote addresses that is recommended to communicate with the + Azure resource on some (Protocol, Port, Direction). All other remote + addresses are recommended to be blocked. :param name: The name of the rule :type name: str - :param direction: The rule;s traffic direction. Possible values include: + :param direction: The rule's direction. Possible values include: 'Inbound', 'Outbound' - :type direction: str or - ~azure.mgmt.security.models.NorthSouthTrafficDirection + :type direction: str or ~azure.mgmt.security.models.Direction :param destination_port: The rule's destination port :type destination_port: int - :param protocols: The rule's transport protocol + :param protocols: The rule's transport protocols :type protocols: list[str or - ~azure.mgmt.security.models.NorthSouthProtocol] - :param allow_remote_addresses: The remote addresses that should be able to + ~azure.mgmt.security.models.TransportProtocol] + :param ip_addresses: The remote IP addresses that should be able to communicate with the Azure resource on the rule's destination port and protocol - :type allow_remote_addresses: list[str] + :type ip_addresses: list[str] """ _attribute_map = { @@ -37,13 +38,13 @@ class TrafficHardeningRule(Model): 'direction': {'key': 'direction', 'type': 'str'}, 'destination_port': {'key': 'destinationPort', 'type': 'int'}, 'protocols': {'key': 'protocols', 'type': '[str]'}, - 'allow_remote_addresses': {'key': 'allowRemoteAddresses', 'type': '[str]'}, + 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, } def __init__(self, **kwargs): - super(TrafficHardeningRule, self).__init__(**kwargs) + super(AdaptiveNetworkControlsRule, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.direction = kwargs.get('direction', None) self.destination_port = kwargs.get('destination_port', None) self.protocols = kwargs.get('protocols', None) - self.allow_remote_addresses = kwargs.get('allow_remote_addresses', None) + self.ip_addresses = kwargs.get('ip_addresses', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule_py3.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule_py3.py similarity index 60% rename from azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule_py3.py rename to azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule_py3.py index afdb62a266b9..e242d087fca7 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/traffic_hardening_rule_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule_py3.py @@ -12,24 +12,25 @@ from msrest.serialization import Model -class TrafficHardeningRule(Model): - """A north-south traffic hardening rule. +class AdaptiveNetworkControlsRule(Model): + """Describes remote addresses that is recommended to communicate with the + Azure resource on some (Protocol, Port, Direction). All other remote + addresses are recommended to be blocked. :param name: The name of the rule :type name: str - :param direction: The rule;s traffic direction. Possible values include: + :param direction: The rule's direction. Possible values include: 'Inbound', 'Outbound' - :type direction: str or - ~azure.mgmt.security.models.NorthSouthTrafficDirection + :type direction: str or ~azure.mgmt.security.models.Direction :param destination_port: The rule's destination port :type destination_port: int - :param protocols: The rule's transport protocol + :param protocols: The rule's transport protocols :type protocols: list[str or - ~azure.mgmt.security.models.NorthSouthProtocol] - :param allow_remote_addresses: The remote addresses that should be able to + ~azure.mgmt.security.models.TransportProtocol] + :param ip_addresses: The remote IP addresses that should be able to communicate with the Azure resource on the rule's destination port and protocol - :type allow_remote_addresses: list[str] + :type ip_addresses: list[str] """ _attribute_map = { @@ -37,13 +38,13 @@ class TrafficHardeningRule(Model): 'direction': {'key': 'direction', 'type': 'str'}, 'destination_port': {'key': 'destinationPort', 'type': 'int'}, 'protocols': {'key': 'protocols', 'type': '[str]'}, - 'allow_remote_addresses': {'key': 'allowRemoteAddresses', 'type': '[str]'}, + 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, } - def __init__(self, *, name: str=None, direction=None, destination_port: int=None, protocols=None, allow_remote_addresses=None, **kwargs) -> None: - super(TrafficHardeningRule, self).__init__(**kwargs) + def __init__(self, *, name: str=None, direction=None, destination_port: int=None, protocols=None, ip_addresses=None, **kwargs) -> None: + super(AdaptiveNetworkControlsRule, self).__init__(**kwargs) self.name = name self.direction = direction self.destination_port = destination_port self.protocols = protocols - self.allow_remote_addresses = allow_remote_addresses + self.ip_addresses = ip_addresses diff --git a/azure-mgmt-security/azure/mgmt/security/models/data_export_setting.py b/azure-mgmt-security/azure/mgmt/security/models/data_export_setting.py index c2eb09c8bebe..8c355e50e6ff 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/data_export_setting.py +++ b/azure-mgmt-security/azure/mgmt/security/models/data_export_setting.py @@ -26,8 +26,10 @@ class DataExportSetting(Setting): :vartype name: str :ivar type: Resource type :vartype type: str - :param kind: Required. Constant filled by server. - :type kind: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind :param enabled: Required. Is the data export setting is enabled :type enabled: bool """ @@ -51,4 +53,3 @@ class DataExportSetting(Setting): def __init__(self, **kwargs): super(DataExportSetting, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) - self.kind = 'DataExportSetting' diff --git a/azure-mgmt-security/azure/mgmt/security/models/data_export_setting_py3.py b/azure-mgmt-security/azure/mgmt/security/models/data_export_setting_py3.py index adab9fae1f04..05d8e11208fc 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/data_export_setting_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/data_export_setting_py3.py @@ -26,8 +26,10 @@ class DataExportSetting(Setting): :vartype name: str :ivar type: Resource type :vartype type: str - :param kind: Required. Constant filled by server. - :type kind: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind :param enabled: Required. Is the data export setting is enabled :type enabled: bool """ @@ -48,7 +50,6 @@ class DataExportSetting(Setting): 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, } - def __init__(self, *, enabled: bool, **kwargs) -> None: - super(DataExportSetting, self).__init__(**kwargs) + def __init__(self, *, kind, enabled: bool, **kwargs) -> None: + super(DataExportSetting, self).__init__(kind=kind, **kwargs) self.enabled = enabled - self.kind = 'DataExportSetting' diff --git a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py index bbc78a78cc99..dd4912e3b78f 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py +++ b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py @@ -39,6 +39,7 @@ class AutoProvision(str, Enum): class SettingKind(str, Enum): data_export_setting = "DataExportSetting" + alert_suppression_setting = "AlertSuppressionSetting" class SecurityFamily(str, Enum): @@ -83,16 +84,16 @@ class ExternalSecuritySolutionKind(str, Enum): aad = "AAD" -class NorthSouthProtocol(str, Enum): +class Direction(str, Enum): - tcp = "TCP" - udp = "UDP" + inbound = "Inbound" + outbound = "Outbound" -class NorthSouthTrafficDirection(str, Enum): +class TransportProtocol(str, Enum): - inbound = "Inbound" - outbound = "Outbound" + tcp = "TCP" + udp = "UDP" class ConnectionType(str, Enum): diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting.py b/azure-mgmt-security/azure/mgmt/security/models/setting.py index 6d9a06822f41..9dd2c8f9944c 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/setting.py +++ b/azure-mgmt-security/azure/mgmt/security/models/setting.py @@ -9,15 +9,12 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from .setting_resource import SettingResource -class Setting(Model): +class Setting(SettingResource): """Represents a security setting in Azure Security Center. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DataExportSetting - Variables are only populated by the server, and will be ignored when sending a request. @@ -29,8 +26,10 @@ class Setting(Model): :vartype name: str :ivar type: Resource type :vartype type: str - :param kind: Required. Constant filled by server. - :type kind: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind """ _validation = { @@ -47,13 +46,5 @@ class Setting(Model): 'kind': {'key': 'kind', 'type': 'str'}, } - _subtype_map = { - 'kind': {'DataExportSetting': 'DataExportSetting'} - } - def __init__(self, **kwargs): super(Setting, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.kind = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting_kind1.py b/azure-mgmt-security/azure/mgmt/security/models/setting_kind1.py deleted file mode 100644 index 4f3753aae68d..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/setting_kind1.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SettingKind1(Model): - """The kind of the security setting. - - :param kind: the kind of the settings string. Possible values include: - 'DataExportSetting' - :type kind: str or ~azure.mgmt.security.models.SettingKind - """ - - _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SettingKind1, self).__init__(**kwargs) - self.kind = kwargs.get('kind', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting_kind1_py3.py b/azure-mgmt-security/azure/mgmt/security/models/setting_kind1_py3.py deleted file mode 100644 index 33f8f077ff41..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/setting_kind1_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SettingKind1(Model): - """The kind of the security setting. - - :param kind: the kind of the settings string. Possible values include: - 'DataExportSetting' - :type kind: str or ~azure.mgmt.security.models.SettingKind - """ - - _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - } - - def __init__(self, *, kind=None, **kwargs) -> None: - super(SettingKind1, self).__init__(**kwargs) - self.kind = kind diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting_py3.py b/azure-mgmt-security/azure/mgmt/security/models/setting_py3.py index fa644684fb2f..0611d4ebdd49 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/setting_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/setting_py3.py @@ -9,15 +9,12 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from .setting_resource_py3 import SettingResource -class Setting(Model): +class Setting(SettingResource): """Represents a security setting in Azure Security Center. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DataExportSetting - Variables are only populated by the server, and will be ignored when sending a request. @@ -29,8 +26,10 @@ class Setting(Model): :vartype name: str :ivar type: Resource type :vartype type: str - :param kind: Required. Constant filled by server. - :type kind: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind """ _validation = { @@ -47,13 +46,5 @@ class Setting(Model): 'kind': {'key': 'kind', 'type': 'str'}, } - _subtype_map = { - 'kind': {'DataExportSetting': 'DataExportSetting'} - } - - def __init__(self, **kwargs) -> None: - super(Setting, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.kind = None + def __init__(self, *, kind, **kwargs) -> None: + super(Setting, self).__init__(kind=kind, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting_resource.py b/azure-mgmt-security/azure/mgmt/security/models/setting_resource.py new file mode 100644 index 000000000000..d20bda7cab66 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/setting_resource.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class SettingResource(Resource): + """The kind of the security setting. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SettingResource, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting_resource_py3.py b/azure-mgmt-security/azure/mgmt/security/models/setting_resource_py3.py new file mode 100644 index 000000000000..4feeff7166c5 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/setting_resource_py3.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource_py3 import Resource + + +class SettingResource(Resource): + """The kind of the security setting. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, kind, **kwargs) -> None: + super(SettingResource, self).__init__(**kwargs) + self.kind = kind diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py deleted file mode 100644 index f8d0a082cbcc..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class TrafficAlert(Model): - """A north-south traffic hardening alert. - - :param detection_date: the date (UTC) that the traffic was detected - :type detection_date: datetime - :param direction: The alert's traffic direction. Possible values include: - 'Inbound', 'Outbound' - :type direction: str or - ~azure.mgmt.security.models.NorthSouthTrafficDirection - :param destination_port: The alert's destination port - :type destination_port: int - :param protocol: The alert's transport protocol. Possible values include: - 'TCP', 'UDP' - :type protocol: str or ~azure.mgmt.security.models.NorthSouthProtocol - :param traffic: The traffic that was detected and raised the alert - :type traffic: list[~azure.mgmt.security.models.TrafficAlertTrafficItem] - """ - - _attribute_map = { - 'detection_date': {'key': 'detectionDate', 'type': 'iso-8601'}, - 'direction': {'key': 'direction', 'type': 'str'}, - 'destination_port': {'key': 'destinationPort', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'traffic': {'key': 'traffic', 'type': '[TrafficAlertTrafficItem]'}, - } - - def __init__(self, **kwargs): - super(TrafficAlert, self).__init__(**kwargs) - self.detection_date = kwargs.get('detection_date', None) - self.direction = kwargs.get('direction', None) - self.destination_port = kwargs.get('destination_port', None) - self.protocol = kwargs.get('protocol', None) - self.traffic = kwargs.get('traffic', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py deleted file mode 100644 index c68bb2132947..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_py3.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class TrafficAlert(Model): - """A north-south traffic hardening alert. - - :param detection_date: the date (UTC) that the traffic was detected - :type detection_date: datetime - :param direction: The alert's traffic direction. Possible values include: - 'Inbound', 'Outbound' - :type direction: str or - ~azure.mgmt.security.models.NorthSouthTrafficDirection - :param destination_port: The alert's destination port - :type destination_port: int - :param protocol: The alert's transport protocol. Possible values include: - 'TCP', 'UDP' - :type protocol: str or ~azure.mgmt.security.models.NorthSouthProtocol - :param traffic: The traffic that was detected and raised the alert - :type traffic: list[~azure.mgmt.security.models.TrafficAlertTrafficItem] - """ - - _attribute_map = { - 'detection_date': {'key': 'detectionDate', 'type': 'iso-8601'}, - 'direction': {'key': 'direction', 'type': 'str'}, - 'destination_port': {'key': 'destinationPort', 'type': 'int'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'traffic': {'key': 'traffic', 'type': '[TrafficAlertTrafficItem]'}, - } - - def __init__(self, *, detection_date=None, direction=None, destination_port: int=None, protocol=None, traffic=None, **kwargs) -> None: - super(TrafficAlert, self).__init__(**kwargs) - self.detection_date = detection_date - self.direction = direction - self.destination_port = destination_port - self.protocol = protocol - self.traffic = traffic diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item.py deleted file mode 100644 index 3f492a3817fb..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class TrafficAlertTrafficItem(Model): - """TrafficAlertTrafficItem. - - :param remote_address: The IP address of the remote host that is - associated with the traffic - :type remote_address: str - :param attempts: The detected number of packets sent to or from the remote - address (depends on the direction of the traffic) - :type attempts: float - """ - - _attribute_map = { - 'remote_address': {'key': 'remoteAddress', 'type': 'str'}, - 'attempts': {'key': 'attempts', 'type': 'float'}, - } - - def __init__(self, **kwargs): - super(TrafficAlertTrafficItem, self).__init__(**kwargs) - self.remote_address = kwargs.get('remote_address', None) - self.attempts = kwargs.get('attempts', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item_py3.py b/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item_py3.py deleted file mode 100644 index 10d9d2e1efce..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/traffic_alert_traffic_item_py3.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class TrafficAlertTrafficItem(Model): - """TrafficAlertTrafficItem. - - :param remote_address: The IP address of the remote host that is - associated with the traffic - :type remote_address: str - :param attempts: The detected number of packets sent to or from the remote - address (depends on the direction of the traffic) - :type attempts: float - """ - - _attribute_map = { - 'remote_address': {'key': 'remoteAddress', 'type': 'str'}, - 'attempts': {'key': 'attempts', 'type': 'float'}, - } - - def __init__(self, *, remote_address: str=None, attempts: float=None, **kwargs) -> None: - super(TrafficAlertTrafficItem, self).__init__(**kwargs) - self.remote_address = remote_address - self.attempts = attempts diff --git a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py index 2faf3be20310..d8fc6c72806b 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py @@ -24,7 +24,7 @@ from .discovered_security_solutions_operations import DiscoveredSecuritySolutionsOperations from .jit_network_access_policies_operations import JitNetworkAccessPoliciesOperations from .external_security_solutions_operations import ExternalSecuritySolutionsOperations -from .north_south_hardenings_operations import NorthSouthHardeningsOperations +from .adaptive_network_controls_operations import AdaptiveNetworkControlsOperations from .topology_operations import TopologyOperations from .allowed_connections_operations import AllowedConnectionsOperations @@ -44,7 +44,7 @@ 'DiscoveredSecuritySolutionsOperations', 'JitNetworkAccessPoliciesOperations', 'ExternalSecuritySolutionsOperations', - 'NorthSouthHardeningsOperations', + 'AdaptiveNetworkControlsOperations', 'TopologyOperations', 'AllowedConnectionsOperations', ] diff --git a/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py similarity index 62% rename from azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py rename to azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py index 6c4ba10d06bb..f8a805665129 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/north_south_hardenings_operations.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py @@ -12,19 +12,21 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models -class NorthSouthHardeningsOperations(object): - """NorthSouthHardeningsOperations operations. +class AdaptiveNetworkControlsOperations(object): + """AdaptiveNetworkControlsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar api_version: API version for the operation. Constant value: "2015-06-01-preview". - :ivar traffic_hardenings_rules_enforce_action: Enforces the given collections of traffic hardenings rule's on the VM's NSG. Constant value: "enforce". + :ivar adaptive_network_controls_enforce_action: Enforces the given rules on the NSG(s) listed in the request. Constant value: "enforce". """ models = models @@ -35,99 +37,46 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.api_version = "2015-06-01-preview" - self.traffic_hardenings_rules_enforce_action = "enforce" + self.adaptive_network_controls_enforce_action = "enforce" self.config = config - def list( - self, custom_headers=None, raw=False, **operation_config): - """Gets a list of north-south hardening resources for the subscription. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of NorthSouthHardenings - :rtype: - ~azure.mgmt.security.models.NorthSouthHardeningsPaged[~azure.mgmt.security.models.NorthSouthHardenings] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.NorthSouthHardeningsPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.NorthSouthHardeningsPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/northSouthHardenings'} - - def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of north-south hardening resources for the resource group. + def list_by_extended_resource( + self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of Adaptive Network Controls resources in scope of the + given extended resource. :param resource_group_name: The name of the resource group within the user's subscription. The name is case insensitive. :type resource_group_name: str + :param extended_resource_provider: Resource provider name of the base + resource + :type extended_resource_provider: str + :param extended_resource_type: Type of the base resource + :type extended_resource_type: str + :param extended_resource_name: The name of the base resource + :type extended_resource_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of NorthSouthHardenings + :return: An iterator like instance of AdaptiveNetworkControls :rtype: - ~azure.mgmt.security.models.NorthSouthHardeningsPaged[~azure.mgmt.security.models.NorthSouthHardenings] + ~azure.mgmt.security.models.AdaptiveNetworkControlsPaged[~azure.mgmt.security.models.AdaptiveNetworkControls] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_extended_resource.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'extendedResourceProvider': self._serialize.url("extended_resource_provider", extended_resource_provider, 'str'), + 'extendedResourceType': self._serialize.url("extended_resource_type", extended_resource_type, 'str'), + 'extendedResourceName': self._serialize.url("extended_resource_name", extended_resource_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -161,19 +110,20 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.NorthSouthHardeningsPaged(internal_paging, self._deserialize.dependencies) + deserialized = models.AdaptiveNetworkControlsPaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.NorthSouthHardeningsPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = models.AdaptiveNetworkControlsPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/northSouthHardenings'} + list_by_extended_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/adaptiveNetworkControls'} def get( - self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, north_south_resource_name, custom_headers=None, raw=False, **operation_config): - """Gets the north-south traffic hardening for the specified resource. + self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, adaptive_network_controls_resource_name, custom_headers=None, raw=False, **operation_config): + """Gets the Adaptive Network Controls resource matching the given resource + ID. :param resource_group_name: The name of the resource group within the user's subscription. The name is case insensitive. @@ -185,15 +135,16 @@ def get( :type extended_resource_type: str :param extended_resource_name: The name of the base resource :type extended_resource_name: str - :param north_south_resource_name: Name of a north-south resource. - :type north_south_resource_name: str + :param adaptive_network_controls_resource_name: The name of the + Adaptive Network Controls resource. + :type adaptive_network_controls_resource_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: NorthSouthHardenings or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.security.models.NorthSouthHardenings or + :return: AdaptiveNetworkControls or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.AdaptiveNetworkControls or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -205,7 +156,7 @@ def get( 'extendedResourceProvider': self._serialize.url("extended_resource_provider", extended_resource_provider, 'str'), 'extendedResourceType': self._serialize.url("extended_resource_type", extended_resource_type, 'str'), 'extendedResourceName': self._serialize.url("extended_resource_name", extended_resource_name, 'str'), - 'northSouthResourceName': self._serialize.url("north_south_resource_name", north_south_resource_name, 'str') + 'adaptiveNetworkControlsResourceName': self._serialize.url("adaptive_network_controls_resource_name", adaptive_network_controls_resource_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -235,41 +186,18 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NorthSouthHardenings', response) + deserialized = self._deserialize('AdaptiveNetworkControls', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/northSouthHardenings/{northSouthResourceName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/adaptiveNetworkControls/{adaptiveNetworkControlsResourceName}'} - def enforce( - self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, north_south_resource_name, custom_headers=None, raw=False, **operation_config): - """Enforces the given collections of traffic hardenings rule's on the VM's - NSG. - :param resource_group_name: The name of the resource group within the - user's subscription. The name is case insensitive. - :type resource_group_name: str - :param extended_resource_provider: Resource provider name of the base - resource - :type extended_resource_provider: str - :param extended_resource_type: Type of the base resource - :type extended_resource_type: str - :param extended_resource_name: The name of the base resource - :type extended_resource_name: str - :param north_south_resource_name: Name of a north-south resource. - :type north_south_resource_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _enforce_initial( + self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, adaptive_network_controls_resource_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.enforce.metadata['url'] path_format_arguments = { @@ -278,8 +206,8 @@ def enforce( 'extendedResourceProvider': self._serialize.url("extended_resource_provider", extended_resource_provider, 'str'), 'extendedResourceType': self._serialize.url("extended_resource_type", extended_resource_type, 'str'), 'extendedResourceName': self._serialize.url("extended_resource_name", extended_resource_name, 'str'), - 'northSouthResourceName': self._serialize.url("north_south_resource_name", north_south_resource_name, 'str'), - 'trafficHardeningsRulesEnforceAction': self._serialize.url("self.traffic_hardenings_rules_enforce_action", self.traffic_hardenings_rules_enforce_action, 'str') + 'adaptiveNetworkControlsResourceName': self._serialize.url("adaptive_network_controls_resource_name", adaptive_network_controls_resource_name, 'str'), + 'adaptiveNetworkControlsEnforceAction': self._serialize.url("self.adaptive_network_controls_enforce_action", self.adaptive_network_controls_enforce_action, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -300,7 +228,7 @@ def enforce( request = self._client.post(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [202, 204]: + if response.status_code not in [202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp @@ -308,4 +236,56 @@ def enforce( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - enforce.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/northSouthHardenings/{northSouthResourceName}/{trafficHardeningsRulesEnforceAction}'} + + def enforce( + self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, adaptive_network_controls_resource_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Enforces the given rules on the NSG(s) listed in the request. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param extended_resource_provider: Resource provider name of the base + resource + :type extended_resource_provider: str + :param extended_resource_type: Type of the base resource + :type extended_resource_type: str + :param extended_resource_name: The name of the base resource + :type extended_resource_name: str + :param adaptive_network_controls_resource_name: The name of the + Adaptive Network Controls resource. + :type adaptive_network_controls_resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._enforce_initial( + resource_group_name=resource_group_name, + extended_resource_provider=extended_resource_provider, + extended_resource_type=extended_resource_type, + extended_resource_name=extended_resource_name, + adaptive_network_controls_resource_name=adaptive_network_controls_resource_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + enforce.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/adaptiveNetworkControls/{adaptiveNetworkControlsResourceName}/{adaptiveNetworkControlsEnforceAction}'} diff --git a/azure-mgmt-security/azure/mgmt/security/operations/settings_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/settings_operations.py index 47b9c1b6d7f5..6aef42b410e1 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/settings_operations.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/settings_operations.py @@ -105,8 +105,8 @@ def get( self, setting_name, custom_headers=None, raw=False, **operation_config): """Settings of different configurations in security center. - :param setting_name: Name of setting. Possible values include: 'MCAS', - 'WDATP' + :param setting_name: Name of setting: (MCAS/WDATP). Possible values + include: 'MCAS', 'WDATP' :type setting_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -162,14 +162,16 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}'} def update( - self, setting_name, setting, custom_headers=None, raw=False, **operation_config): + self, setting_name, kind, custom_headers=None, raw=False, **operation_config): """updating settings about different configurations in security center. - :param setting_name: Name of setting. Possible values include: 'MCAS', - 'WDATP' + :param setting_name: Name of setting: (MCAS/WDATP). Possible values + include: 'MCAS', 'WDATP' :type setting_name: str - :param setting: Setting object - :type setting: ~azure.mgmt.security.models.Setting + :param kind: the kind of the settings string (DataExportSetting). + Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -180,6 +182,8 @@ def update( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + setting = models.Setting(kind=kind) + # Construct URL url = self.update.metadata['url'] path_format_arguments = { diff --git a/azure-mgmt-security/azure/mgmt/security/security_center.py b/azure-mgmt-security/azure/mgmt/security/security_center.py index 2d3f21f20f05..d17e7db85e40 100644 --- a/azure-mgmt-security/azure/mgmt/security/security_center.py +++ b/azure-mgmt-security/azure/mgmt/security/security_center.py @@ -28,7 +28,7 @@ from .operations.discovered_security_solutions_operations import DiscoveredSecuritySolutionsOperations from .operations.jit_network_access_policies_operations import JitNetworkAccessPoliciesOperations from .operations.external_security_solutions_operations import ExternalSecuritySolutionsOperations -from .operations.north_south_hardenings_operations import NorthSouthHardeningsOperations +from .operations.adaptive_network_controls_operations import AdaptiveNetworkControlsOperations from .operations.topology_operations import TopologyOperations from .operations.allowed_connections_operations import AllowedConnectionsOperations from . import models @@ -108,8 +108,8 @@ class SecurityCenter(SDKClient): :vartype jit_network_access_policies: azure.mgmt.security.operations.JitNetworkAccessPoliciesOperations :ivar external_security_solutions: ExternalSecuritySolutions operations :vartype external_security_solutions: azure.mgmt.security.operations.ExternalSecuritySolutionsOperations - :ivar north_south_hardenings: NorthSouthHardenings operations - :vartype north_south_hardenings: azure.mgmt.security.operations.NorthSouthHardeningsOperations + :ivar adaptive_network_controls: AdaptiveNetworkControls operations + :vartype adaptive_network_controls: azure.mgmt.security.operations.AdaptiveNetworkControlsOperations :ivar topology: Topology operations :vartype topology: azure.mgmt.security.operations.TopologyOperations :ivar allowed_connections: AllowedConnections operations @@ -166,7 +166,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.external_security_solutions = ExternalSecuritySolutionsOperations( self._client, self.config, self._serialize, self._deserialize) - self.north_south_hardenings = NorthSouthHardeningsOperations( + self.adaptive_network_controls = AdaptiveNetworkControlsOperations( self._client, self.config, self._serialize, self._deserialize) self.topology = TopologyOperations( self._client, self.config, self._serialize, self._deserialize) From 7ce92365e38d2ae8c52777cd41967b65803232ea Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 16 Jan 2019 07:36:19 +0000 Subject: [PATCH 06/11] Generated from 2e6d2abd5c70e8dffd3b79f7a2e8b940eacc53f7 Updating EnforceAdaptiveNetworkControlsRules_example.json with the new status code --- .../security/operations/adaptive_network_controls_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py index f8a805665129..ae80c3291d54 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py @@ -228,7 +228,7 @@ def _enforce_initial( request = self._client.post(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [202]: + if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp From 8f1ba7a7812252df46f5669e63a940435144184a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 5 Mar 2019 14:59:50 +0000 Subject: [PATCH 07/11] Generated from 0b7b1567b73f9eea37c817e9984edf4ba2eafbec Merge branch 'Azure-master' --- .../azure/mgmt/security/models/__init__.py | 74 ++--- .../models/adaptive_network_controls.py | 59 ---- ...trols_effective_network_security_groups.py | 33 -- ...s_effective_network_security_groups_py3.py | 33 -- .../models/adaptive_network_controls_paged.py | 27 -- .../models/adaptive_network_controls_py3.py | 59 ---- .../models/adaptive_network_controls_rule.py | 50 --- .../adaptive_network_controls_rule_py3.py | 50 --- .../azure/mgmt/security/models/alert.py | 12 +- .../azure/mgmt/security/models/alert_py3.py | 12 +- .../azure/mgmt/security/models/pricing.py | 10 +- .../mgmt/security/models/pricing_list.py | 34 ++ .../mgmt/security/models/pricing_list_py3.py | 34 ++ .../mgmt/security/models/pricing_paged.py | 27 -- .../azure/mgmt/security/models/pricing_py3.py | 10 +- .../security/models/security_center_enums.py | 32 +- .../mgmt/security/operations/__init__.py | 2 - .../adaptive_network_controls_operations.py | 291 ------------------ .../security/operations/alerts_operations.py | 4 +- .../operations/pricings_operations.py | 248 ++------------- .../workspace_settings_operations.py | 8 +- .../azure/mgmt/security/security_center.py | 5 - 22 files changed, 175 insertions(+), 939 deletions(-) delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups_py3.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_paged.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_py3.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/pricing_list.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/pricing_list_py3.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/pricing_paged.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py diff --git a/azure-mgmt-security/azure/mgmt/security/models/__init__.py b/azure-mgmt-security/azure/mgmt/security/models/__init__.py index 43480334118a..b72e7878ab32 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/models/__init__.py @@ -10,10 +10,11 @@ # -------------------------------------------------------------------------- try: + from .pricing_py3 import Pricing + from .pricing_list_py3 import PricingList + from .asc_location_py3 import AscLocation from .resource_py3 import Resource - from .kind_py3 import Kind from .security_contact_py3 import SecurityContact - from .pricing_py3 import Pricing from .workspace_setting_py3 import WorkspaceSetting from .auto_provisioning_setting_py3 import AutoProvisioningSetting from .compliance_segment_py3 import ComplianceSegment @@ -26,20 +27,15 @@ from .information_protection_keyword_py3 import InformationProtectionKeyword from .information_type_py3 import InformationType from .information_protection_policy_py3 import InformationProtectionPolicy - from .location_py3 import Location from .operation_display_py3 import OperationDisplay from .operation_py3 import Operation from .security_task_parameters_py3 import SecurityTaskParameters from .security_task_py3 import SecurityTask - from .asc_location_py3 import AscLocation from .alert_entity_py3 import AlertEntity from .alert_confidence_reason_py3 import AlertConfidenceReason from .alert_py3 import Alert from .discovered_security_solution_py3 import DiscoveredSecuritySolution - from .topology_single_resource_parent_py3 import TopologySingleResourceParent - from .topology_single_resource_child_py3 import TopologySingleResourceChild - from .topology_single_resource_py3 import TopologySingleResource - from .topology_resource_py3 import TopologyResource + from .location_py3 import Location from .jit_network_access_port_rule_py3 import JitNetworkAccessPortRule from .jit_network_access_policy_virtual_machine_py3 import JitNetworkAccessPolicyVirtualMachine from .jit_network_access_request_port_py3 import JitNetworkAccessRequestPort @@ -49,6 +45,7 @@ from .jit_network_access_policy_initiate_port_py3 import JitNetworkAccessPolicyInitiatePort from .jit_network_access_policy_initiate_virtual_machine_py3 import JitNetworkAccessPolicyInitiateVirtualMachine from .jit_network_access_policy_initiate_request_py3 import JitNetworkAccessPolicyInitiateRequest + from .kind_py3 import Kind from .external_security_solution_py3 import ExternalSecuritySolution from .cef_solution_properties_py3 import CefSolutionProperties from .cef_external_security_solution_py3 import CefExternalSecuritySolution @@ -60,17 +57,19 @@ from .external_security_solution_kind1_py3 import ExternalSecuritySolutionKind1 from .external_security_solution_properties_py3 import ExternalSecuritySolutionProperties from .aad_connectivity_state1_py3 import AadConnectivityState1 - from .adaptive_network_controls_rule_py3 import AdaptiveNetworkControlsRule - from .adaptive_network_controls_effective_network_security_groups_py3 import AdaptiveNetworkControlsEffectiveNetworkSecurityGroups - from .adaptive_network_controls_py3 import AdaptiveNetworkControls + from .topology_single_resource_parent_py3 import TopologySingleResourceParent + from .topology_single_resource_child_py3 import TopologySingleResourceChild + from .topology_single_resource_py3 import TopologySingleResource + from .topology_resource_py3 import TopologyResource from .connected_resource_py3 import ConnectedResource from .connectable_resource_py3 import ConnectableResource from .allowed_connections_resource_py3 import AllowedConnectionsResource except (SyntaxError, ImportError): + from .pricing import Pricing + from .pricing_list import PricingList + from .asc_location import AscLocation from .resource import Resource - from .kind import Kind from .security_contact import SecurityContact - from .pricing import Pricing from .workspace_setting import WorkspaceSetting from .auto_provisioning_setting import AutoProvisioningSetting from .compliance_segment import ComplianceSegment @@ -83,20 +82,15 @@ from .information_protection_keyword import InformationProtectionKeyword from .information_type import InformationType from .information_protection_policy import InformationProtectionPolicy - from .location import Location from .operation_display import OperationDisplay from .operation import Operation from .security_task_parameters import SecurityTaskParameters from .security_task import SecurityTask - from .asc_location import AscLocation from .alert_entity import AlertEntity from .alert_confidence_reason import AlertConfidenceReason from .alert import Alert from .discovered_security_solution import DiscoveredSecuritySolution - from .topology_single_resource_parent import TopologySingleResourceParent - from .topology_single_resource_child import TopologySingleResourceChild - from .topology_single_resource import TopologySingleResource - from .topology_resource import TopologyResource + from .location import Location from .jit_network_access_port_rule import JitNetworkAccessPortRule from .jit_network_access_policy_virtual_machine import JitNetworkAccessPolicyVirtualMachine from .jit_network_access_request_port import JitNetworkAccessRequestPort @@ -106,6 +100,7 @@ from .jit_network_access_policy_initiate_port import JitNetworkAccessPolicyInitiatePort from .jit_network_access_policy_initiate_virtual_machine import JitNetworkAccessPolicyInitiateVirtualMachine from .jit_network_access_policy_initiate_request import JitNetworkAccessPolicyInitiateRequest + from .kind import Kind from .external_security_solution import ExternalSecuritySolution from .cef_solution_properties import CefSolutionProperties from .cef_external_security_solution import CefExternalSecuritySolution @@ -117,13 +112,13 @@ from .external_security_solution_kind1 import ExternalSecuritySolutionKind1 from .external_security_solution_properties import ExternalSecuritySolutionProperties from .aad_connectivity_state1 import AadConnectivityState1 - from .adaptive_network_controls_rule import AdaptiveNetworkControlsRule - from .adaptive_network_controls_effective_network_security_groups import AdaptiveNetworkControlsEffectiveNetworkSecurityGroups - from .adaptive_network_controls import AdaptiveNetworkControls + from .topology_single_resource_parent import TopologySingleResourceParent + from .topology_single_resource_child import TopologySingleResourceChild + from .topology_single_resource import TopologySingleResource + from .topology_resource import TopologyResource from .connected_resource import ConnectedResource from .connectable_resource import ConnectableResource from .allowed_connections_resource import AllowedConnectionsResource -from .pricing_paged import PricingPaged from .security_contact_paged import SecurityContactPaged from .workspace_setting_paged import WorkspaceSettingPaged from .auto_provisioning_setting_paged import AutoProvisioningSettingPaged @@ -137,31 +132,30 @@ from .discovered_security_solution_paged import DiscoveredSecuritySolutionPaged from .jit_network_access_policy_paged import JitNetworkAccessPolicyPaged from .external_security_solution_paged import ExternalSecuritySolutionPaged -from .adaptive_network_controls_paged import AdaptiveNetworkControlsPaged from .topology_resource_paged import TopologyResourcePaged from .allowed_connections_resource_paged import AllowedConnectionsResourcePaged from .security_center_enums import ( + PricingTier, AlertNotifications, AlertsToAdmins, - PricingTier, AutoProvision, SettingKind, + ReportedSeverity, SecurityFamily, Protocol, Status, StatusReason, AadConnectivityState, ExternalSecuritySolutionKind, - Direction, - TransportProtocol, ConnectionType, ) __all__ = [ + 'Pricing', + 'PricingList', + 'AscLocation', 'Resource', - 'Kind', 'SecurityContact', - 'Pricing', 'WorkspaceSetting', 'AutoProvisioningSetting', 'ComplianceSegment', @@ -174,20 +168,15 @@ 'InformationProtectionKeyword', 'InformationType', 'InformationProtectionPolicy', - 'Location', 'OperationDisplay', 'Operation', 'SecurityTaskParameters', 'SecurityTask', - 'AscLocation', 'AlertEntity', 'AlertConfidenceReason', 'Alert', 'DiscoveredSecuritySolution', - 'TopologySingleResourceParent', - 'TopologySingleResourceChild', - 'TopologySingleResource', - 'TopologyResource', + 'Location', 'JitNetworkAccessPortRule', 'JitNetworkAccessPolicyVirtualMachine', 'JitNetworkAccessRequestPort', @@ -197,6 +186,7 @@ 'JitNetworkAccessPolicyInitiatePort', 'JitNetworkAccessPolicyInitiateVirtualMachine', 'JitNetworkAccessPolicyInitiateRequest', + 'Kind', 'ExternalSecuritySolution', 'CefSolutionProperties', 'CefExternalSecuritySolution', @@ -208,13 +198,13 @@ 'ExternalSecuritySolutionKind1', 'ExternalSecuritySolutionProperties', 'AadConnectivityState1', - 'AdaptiveNetworkControlsRule', - 'AdaptiveNetworkControlsEffectiveNetworkSecurityGroups', - 'AdaptiveNetworkControls', + 'TopologySingleResourceParent', + 'TopologySingleResourceChild', + 'TopologySingleResource', + 'TopologyResource', 'ConnectedResource', 'ConnectableResource', 'AllowedConnectionsResource', - 'PricingPaged', 'SecurityContactPaged', 'WorkspaceSettingPaged', 'AutoProvisioningSettingPaged', @@ -228,21 +218,19 @@ 'DiscoveredSecuritySolutionPaged', 'JitNetworkAccessPolicyPaged', 'ExternalSecuritySolutionPaged', - 'AdaptiveNetworkControlsPaged', 'TopologyResourcePaged', 'AllowedConnectionsResourcePaged', + 'PricingTier', 'AlertNotifications', 'AlertsToAdmins', - 'PricingTier', 'AutoProvision', 'SettingKind', + 'ReportedSeverity', 'SecurityFamily', 'Protocol', 'Status', 'StatusReason', 'AadConnectivityState', 'ExternalSecuritySolutionKind', - 'Direction', - 'TransportProtocol', 'ConnectionType', ] diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls.py deleted file mode 100644 index 2834f76094a6..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls.py +++ /dev/null @@ -1,59 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource import Resource - - -class AdaptiveNetworkControls(Resource): - """The resource whose properties describes the Adaptive Network Controls - settings for some Azure resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id - :vartype id: str - :ivar name: Resource name - :vartype name: str - :ivar type: Resource type - :vartype type: str - :param rules: The security rules which are recommended to be effective on - the VM - :type rules: list[~azure.mgmt.security.models.AdaptiveNetworkControlsRule] - :param rules_calculation_time: The UTC time on which the rules were - calculated - :type rules_calculation_time: datetime - :param effective_network_security_groups: The Network Security Groups - effective on the network interfaces of the protected resource - :type effective_network_security_groups: - list[~azure.mgmt.security.models.AdaptiveNetworkControlsEffectiveNetworkSecurityGroups] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rules': {'key': 'properties.rules', 'type': '[AdaptiveNetworkControlsRule]'}, - 'rules_calculation_time': {'key': 'properties.rulesCalculationTime', 'type': 'iso-8601'}, - 'effective_network_security_groups': {'key': 'properties.effectiveNetworkSecurityGroups', 'type': '[AdaptiveNetworkControlsEffectiveNetworkSecurityGroups]'}, - } - - def __init__(self, **kwargs): - super(AdaptiveNetworkControls, self).__init__(**kwargs) - self.rules = kwargs.get('rules', None) - self.rules_calculation_time = kwargs.get('rules_calculation_time', None) - self.effective_network_security_groups = kwargs.get('effective_network_security_groups', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups.py deleted file mode 100644 index 25958f239461..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class AdaptiveNetworkControlsEffectiveNetworkSecurityGroups(Model): - """Describes the Network Security Groups effective on a network interface. - - :param network_interface: The Azure resource ID of the network interface - :type network_interface: str - :param network_security_groups: The Network Security Groups effective on - the network interface - :type network_security_groups: list[str] - """ - - _attribute_map = { - 'network_interface': {'key': 'networkInterface', 'type': 'str'}, - 'network_security_groups': {'key': 'networkSecurityGroups', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(AdaptiveNetworkControlsEffectiveNetworkSecurityGroups, self).__init__(**kwargs) - self.network_interface = kwargs.get('network_interface', None) - self.network_security_groups = kwargs.get('network_security_groups', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups_py3.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups_py3.py deleted file mode 100644 index aa1defc37c82..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_effective_network_security_groups_py3.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class AdaptiveNetworkControlsEffectiveNetworkSecurityGroups(Model): - """Describes the Network Security Groups effective on a network interface. - - :param network_interface: The Azure resource ID of the network interface - :type network_interface: str - :param network_security_groups: The Network Security Groups effective on - the network interface - :type network_security_groups: list[str] - """ - - _attribute_map = { - 'network_interface': {'key': 'networkInterface', 'type': 'str'}, - 'network_security_groups': {'key': 'networkSecurityGroups', 'type': '[str]'}, - } - - def __init__(self, *, network_interface: str=None, network_security_groups=None, **kwargs) -> None: - super(AdaptiveNetworkControlsEffectiveNetworkSecurityGroups, self).__init__(**kwargs) - self.network_interface = network_interface - self.network_security_groups = network_security_groups diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_paged.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_paged.py deleted file mode 100644 index 3fe658a50233..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class AdaptiveNetworkControlsPaged(Paged): - """ - A paging container for iterating over a list of :class:`AdaptiveNetworkControls ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AdaptiveNetworkControls]'} - } - - def __init__(self, *args, **kwargs): - - super(AdaptiveNetworkControlsPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_py3.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_py3.py deleted file mode 100644 index 23a6fa6e2865..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_py3.py +++ /dev/null @@ -1,59 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .resource_py3 import Resource - - -class AdaptiveNetworkControls(Resource): - """The resource whose properties describes the Adaptive Network Controls - settings for some Azure resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource Id - :vartype id: str - :ivar name: Resource name - :vartype name: str - :ivar type: Resource type - :vartype type: str - :param rules: The security rules which are recommended to be effective on - the VM - :type rules: list[~azure.mgmt.security.models.AdaptiveNetworkControlsRule] - :param rules_calculation_time: The UTC time on which the rules were - calculated - :type rules_calculation_time: datetime - :param effective_network_security_groups: The Network Security Groups - effective on the network interfaces of the protected resource - :type effective_network_security_groups: - list[~azure.mgmt.security.models.AdaptiveNetworkControlsEffectiveNetworkSecurityGroups] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'rules': {'key': 'properties.rules', 'type': '[AdaptiveNetworkControlsRule]'}, - 'rules_calculation_time': {'key': 'properties.rulesCalculationTime', 'type': 'iso-8601'}, - 'effective_network_security_groups': {'key': 'properties.effectiveNetworkSecurityGroups', 'type': '[AdaptiveNetworkControlsEffectiveNetworkSecurityGroups]'}, - } - - def __init__(self, *, rules=None, rules_calculation_time=None, effective_network_security_groups=None, **kwargs) -> None: - super(AdaptiveNetworkControls, self).__init__(**kwargs) - self.rules = rules - self.rules_calculation_time = rules_calculation_time - self.effective_network_security_groups = effective_network_security_groups diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule.py deleted file mode 100644 index 4d9edd891960..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule.py +++ /dev/null @@ -1,50 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class AdaptiveNetworkControlsRule(Model): - """Describes remote addresses that is recommended to communicate with the - Azure resource on some (Protocol, Port, Direction). All other remote - addresses are recommended to be blocked. - - :param name: The name of the rule - :type name: str - :param direction: The rule's direction. Possible values include: - 'Inbound', 'Outbound' - :type direction: str or ~azure.mgmt.security.models.Direction - :param destination_port: The rule's destination port - :type destination_port: int - :param protocols: The rule's transport protocols - :type protocols: list[str or - ~azure.mgmt.security.models.TransportProtocol] - :param ip_addresses: The remote IP addresses that should be able to - communicate with the Azure resource on the rule's destination port and - protocol - :type ip_addresses: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'direction': {'key': 'direction', 'type': 'str'}, - 'destination_port': {'key': 'destinationPort', 'type': 'int'}, - 'protocols': {'key': 'protocols', 'type': '[str]'}, - 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(AdaptiveNetworkControlsRule, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.direction = kwargs.get('direction', None) - self.destination_port = kwargs.get('destination_port', None) - self.protocols = kwargs.get('protocols', None) - self.ip_addresses = kwargs.get('ip_addresses', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule_py3.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule_py3.py deleted file mode 100644 index e242d087fca7..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_controls_rule_py3.py +++ /dev/null @@ -1,50 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class AdaptiveNetworkControlsRule(Model): - """Describes remote addresses that is recommended to communicate with the - Azure resource on some (Protocol, Port, Direction). All other remote - addresses are recommended to be blocked. - - :param name: The name of the rule - :type name: str - :param direction: The rule's direction. Possible values include: - 'Inbound', 'Outbound' - :type direction: str or ~azure.mgmt.security.models.Direction - :param destination_port: The rule's destination port - :type destination_port: int - :param protocols: The rule's transport protocols - :type protocols: list[str or - ~azure.mgmt.security.models.TransportProtocol] - :param ip_addresses: The remote IP addresses that should be able to - communicate with the Azure resource on the rule's destination port and - protocol - :type ip_addresses: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'direction': {'key': 'direction', 'type': 'str'}, - 'destination_port': {'key': 'destinationPort', 'type': 'int'}, - 'protocols': {'key': 'protocols', 'type': '[str]'}, - 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, - } - - def __init__(self, *, name: str=None, direction=None, destination_port: int=None, protocols=None, ip_addresses=None, **kwargs) -> None: - super(AdaptiveNetworkControlsRule, self).__init__(**kwargs) - self.name = name - self.direction = direction - self.destination_port = destination_port - self.protocols = protocols - self.ip_addresses = ip_addresses diff --git a/azure-mgmt-security/azure/mgmt/security/models/alert.py b/azure-mgmt-security/azure/mgmt/security/models/alert.py index bdd5963a2b38..965e5877b722 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/alert.py +++ b/azure-mgmt-security/azure/mgmt/security/models/alert.py @@ -44,8 +44,10 @@ class Alert(Resource): :ivar action_taken: The action that was taken as a response to the alert (Active, Blocked etc.) :vartype action_taken: str - :ivar reported_severity: Estimated severity of this alert - :vartype reported_severity: str + :ivar reported_severity: Estimated severity of this alert. Possible values + include: 'Informational', 'Low', 'Medium', 'High' + :vartype reported_severity: str or + ~azure.mgmt.security.models.ReportedSeverity :ivar compromised_entity: The entity that the incident happened on :vartype compromised_entity: str :ivar associated_resource: Azure resource ID of the associated resource @@ -57,6 +59,9 @@ class Alert(Resource): :ivar can_be_investigated: Whether this alert can be investigated with Azure Security Center :vartype can_be_investigated: bool + :ivar is_incident: Whether this alert is for incident type or not + (otherwise - single alert) + :vartype is_incident: bool :param entities: objects that are related to this alerts :type entities: list[~azure.mgmt.security.models.AlertEntity] :ivar confidence_score: level of confidence we have on the alert @@ -93,6 +98,7 @@ class Alert(Resource): 'associated_resource': {'readonly': True}, 'system_source': {'readonly': True}, 'can_be_investigated': {'readonly': True}, + 'is_incident': {'readonly': True}, 'confidence_score': {'readonly': True, 'maximum': 1, 'minimum': 0}, 'subscription_id': {'readonly': True}, 'instance_id': {'readonly': True}, @@ -118,6 +124,7 @@ class Alert(Resource): 'extended_properties': {'key': 'properties.extendedProperties', 'type': '{object}'}, 'system_source': {'key': 'properties.systemSource', 'type': 'str'}, 'can_be_investigated': {'key': 'properties.canBeInvestigated', 'type': 'bool'}, + 'is_incident': {'key': 'properties.isIncident', 'type': 'bool'}, 'entities': {'key': 'properties.entities', 'type': '[AlertEntity]'}, 'confidence_score': {'key': 'properties.confidenceScore', 'type': 'float'}, 'confidence_reasons': {'key': 'properties.confidenceReasons', 'type': '[AlertConfidenceReason]'}, @@ -143,6 +150,7 @@ def __init__(self, **kwargs): self.extended_properties = kwargs.get('extended_properties', None) self.system_source = None self.can_be_investigated = None + self.is_incident = None self.entities = kwargs.get('entities', None) self.confidence_score = None self.confidence_reasons = kwargs.get('confidence_reasons', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/alert_py3.py b/azure-mgmt-security/azure/mgmt/security/models/alert_py3.py index b5c9aff63df5..c73685113d7a 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/alert_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/alert_py3.py @@ -44,8 +44,10 @@ class Alert(Resource): :ivar action_taken: The action that was taken as a response to the alert (Active, Blocked etc.) :vartype action_taken: str - :ivar reported_severity: Estimated severity of this alert - :vartype reported_severity: str + :ivar reported_severity: Estimated severity of this alert. Possible values + include: 'Informational', 'Low', 'Medium', 'High' + :vartype reported_severity: str or + ~azure.mgmt.security.models.ReportedSeverity :ivar compromised_entity: The entity that the incident happened on :vartype compromised_entity: str :ivar associated_resource: Azure resource ID of the associated resource @@ -57,6 +59,9 @@ class Alert(Resource): :ivar can_be_investigated: Whether this alert can be investigated with Azure Security Center :vartype can_be_investigated: bool + :ivar is_incident: Whether this alert is for incident type or not + (otherwise - single alert) + :vartype is_incident: bool :param entities: objects that are related to this alerts :type entities: list[~azure.mgmt.security.models.AlertEntity] :ivar confidence_score: level of confidence we have on the alert @@ -93,6 +98,7 @@ class Alert(Resource): 'associated_resource': {'readonly': True}, 'system_source': {'readonly': True}, 'can_be_investigated': {'readonly': True}, + 'is_incident': {'readonly': True}, 'confidence_score': {'readonly': True, 'maximum': 1, 'minimum': 0}, 'subscription_id': {'readonly': True}, 'instance_id': {'readonly': True}, @@ -118,6 +124,7 @@ class Alert(Resource): 'extended_properties': {'key': 'properties.extendedProperties', 'type': '{object}'}, 'system_source': {'key': 'properties.systemSource', 'type': 'str'}, 'can_be_investigated': {'key': 'properties.canBeInvestigated', 'type': 'bool'}, + 'is_incident': {'key': 'properties.isIncident', 'type': 'bool'}, 'entities': {'key': 'properties.entities', 'type': '[AlertEntity]'}, 'confidence_score': {'key': 'properties.confidenceScore', 'type': 'float'}, 'confidence_reasons': {'key': 'properties.confidenceReasons', 'type': '[AlertConfidenceReason]'}, @@ -143,6 +150,7 @@ def __init__(self, *, extended_properties=None, entities=None, confidence_reason self.extended_properties = extended_properties self.system_source = None self.can_be_investigated = None + self.is_incident = None self.entities = entities self.confidence_score = None self.confidence_reasons = confidence_reasons diff --git a/azure-mgmt-security/azure/mgmt/security/models/pricing.py b/azure-mgmt-security/azure/mgmt/security/models/pricing.py index 320e3dc9e4dc..8201c965f0a5 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/pricing.py +++ b/azure-mgmt-security/azure/mgmt/security/models/pricing.py @@ -26,9 +26,12 @@ class Pricing(Resource): :vartype name: str :ivar type: Resource type :vartype type: str - :param pricing_tier: Required. Pricing tier type. Possible values include: - 'Free', 'Standard' + :param pricing_tier: Required. The pricing tier value. Possible values + include: 'Free', 'Standard' :type pricing_tier: str or ~azure.mgmt.security.models.PricingTier + :ivar free_trial_remaining_time: The duration left for the subscriptions + free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S). + :vartype free_trial_remaining_time: timedelta """ _validation = { @@ -36,6 +39,7 @@ class Pricing(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'pricing_tier': {'required': True}, + 'free_trial_remaining_time': {'readonly': True}, } _attribute_map = { @@ -43,8 +47,10 @@ class Pricing(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'pricing_tier': {'key': 'properties.pricingTier', 'type': 'str'}, + 'free_trial_remaining_time': {'key': 'properties.freeTrialRemainingTime', 'type': 'duration'}, } def __init__(self, **kwargs): super(Pricing, self).__init__(**kwargs) self.pricing_tier = kwargs.get('pricing_tier', None) + self.free_trial_remaining_time = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/pricing_list.py b/azure-mgmt-security/azure/mgmt/security/models/pricing_list.py new file mode 100644 index 000000000000..5c461c74609d --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/pricing_list.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PricingList(Model): + """List of pricing configurations response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. List of pricing configurations + :type value: list[~azure.mgmt.security.models.Pricing] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Pricing]'}, + } + + def __init__(self, **kwargs): + super(PricingList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/pricing_list_py3.py b/azure-mgmt-security/azure/mgmt/security/models/pricing_list_py3.py new file mode 100644 index 000000000000..564f6bab68b9 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/pricing_list_py3.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class PricingList(Model): + """List of pricing configurations response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. List of pricing configurations + :type value: list[~azure.mgmt.security.models.Pricing] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Pricing]'}, + } + + def __init__(self, *, value, **kwargs) -> None: + super(PricingList, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-security/azure/mgmt/security/models/pricing_paged.py b/azure-mgmt-security/azure/mgmt/security/models/pricing_paged.py deleted file mode 100644 index 09eee4ab69dd..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/pricing_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class PricingPaged(Paged): - """ - A paging container for iterating over a list of :class:`Pricing ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Pricing]'} - } - - def __init__(self, *args, **kwargs): - - super(PricingPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/pricing_py3.py b/azure-mgmt-security/azure/mgmt/security/models/pricing_py3.py index 25001e835a78..cab29e683d39 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/pricing_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/pricing_py3.py @@ -26,9 +26,12 @@ class Pricing(Resource): :vartype name: str :ivar type: Resource type :vartype type: str - :param pricing_tier: Required. Pricing tier type. Possible values include: - 'Free', 'Standard' + :param pricing_tier: Required. The pricing tier value. Possible values + include: 'Free', 'Standard' :type pricing_tier: str or ~azure.mgmt.security.models.PricingTier + :ivar free_trial_remaining_time: The duration left for the subscriptions + free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S). + :vartype free_trial_remaining_time: timedelta """ _validation = { @@ -36,6 +39,7 @@ class Pricing(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'pricing_tier': {'required': True}, + 'free_trial_remaining_time': {'readonly': True}, } _attribute_map = { @@ -43,8 +47,10 @@ class Pricing(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'pricing_tier': {'key': 'properties.pricingTier', 'type': 'str'}, + 'free_trial_remaining_time': {'key': 'properties.freeTrialRemainingTime', 'type': 'duration'}, } def __init__(self, *, pricing_tier, **kwargs) -> None: super(Pricing, self).__init__(**kwargs) self.pricing_tier = pricing_tier + self.free_trial_remaining_time = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py index dd4912e3b78f..6c105302e027 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py +++ b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py @@ -12,6 +12,12 @@ from enum import Enum +class PricingTier(str, Enum): + + free = "Free" #: Get free Azure security center experience with basic security features + standard = "Standard" #: Get the standard Azure security center experience with advanced security features + + class AlertNotifications(str, Enum): on = "On" #: Get notifications on new alerts @@ -24,12 +30,6 @@ class AlertsToAdmins(str, Enum): off = "Off" #: Don't send notification on new alerts to the subscription's admins -class PricingTier(str, Enum): - - free = "Free" #: Get free Azure security center experience with basic security features - standard = "Standard" #: Get the standard Azure security center experience with advanced security features - - class AutoProvision(str, Enum): on = "On" #: Install missing security agent on VMs automatically @@ -42,6 +42,14 @@ class SettingKind(str, Enum): alert_suppression_setting = "AlertSuppressionSetting" +class ReportedSeverity(str, Enum): + + informational = "Informational" + low = "Low" + medium = "Medium" + high = "High" + + class SecurityFamily(str, Enum): waf = "Waf" @@ -84,18 +92,6 @@ class ExternalSecuritySolutionKind(str, Enum): aad = "AAD" -class Direction(str, Enum): - - inbound = "Inbound" - outbound = "Outbound" - - -class TransportProtocol(str, Enum): - - tcp = "TCP" - udp = "UDP" - - class ConnectionType(str, Enum): internal = "Internal" diff --git a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py index d8fc6c72806b..cc451ba3dd54 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py @@ -24,7 +24,6 @@ from .discovered_security_solutions_operations import DiscoveredSecuritySolutionsOperations from .jit_network_access_policies_operations import JitNetworkAccessPoliciesOperations from .external_security_solutions_operations import ExternalSecuritySolutionsOperations -from .adaptive_network_controls_operations import AdaptiveNetworkControlsOperations from .topology_operations import TopologyOperations from .allowed_connections_operations import AllowedConnectionsOperations @@ -44,7 +43,6 @@ 'DiscoveredSecuritySolutionsOperations', 'JitNetworkAccessPoliciesOperations', 'ExternalSecuritySolutionsOperations', - 'AdaptiveNetworkControlsOperations', 'TopologyOperations', 'AllowedConnectionsOperations', ] diff --git a/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py deleted file mode 100644 index ae80c3291d54..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_controls_operations.py +++ /dev/null @@ -1,291 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class AdaptiveNetworkControlsOperations(object): - """AdaptiveNetworkControlsOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: API version for the operation. Constant value: "2015-06-01-preview". - :ivar adaptive_network_controls_enforce_action: Enforces the given rules on the NSG(s) listed in the request. Constant value: "enforce". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2015-06-01-preview" - self.adaptive_network_controls_enforce_action = "enforce" - - self.config = config - - def list_by_extended_resource( - self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of Adaptive Network Controls resources in scope of the - given extended resource. - - :param resource_group_name: The name of the resource group within the - user's subscription. The name is case insensitive. - :type resource_group_name: str - :param extended_resource_provider: Resource provider name of the base - resource - :type extended_resource_provider: str - :param extended_resource_type: Type of the base resource - :type extended_resource_type: str - :param extended_resource_name: The name of the base resource - :type extended_resource_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AdaptiveNetworkControls - :rtype: - ~azure.mgmt.security.models.AdaptiveNetworkControlsPaged[~azure.mgmt.security.models.AdaptiveNetworkControls] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_extended_resource.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'extendedResourceProvider': self._serialize.url("extended_resource_provider", extended_resource_provider, 'str'), - 'extendedResourceType': self._serialize.url("extended_resource_type", extended_resource_type, 'str'), - 'extendedResourceName': self._serialize.url("extended_resource_name", extended_resource_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.AdaptiveNetworkControlsPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.AdaptiveNetworkControlsPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_extended_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/adaptiveNetworkControls'} - - def get( - self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, adaptive_network_controls_resource_name, custom_headers=None, raw=False, **operation_config): - """Gets the Adaptive Network Controls resource matching the given resource - ID. - - :param resource_group_name: The name of the resource group within the - user's subscription. The name is case insensitive. - :type resource_group_name: str - :param extended_resource_provider: Resource provider name of the base - resource - :type extended_resource_provider: str - :param extended_resource_type: Type of the base resource - :type extended_resource_type: str - :param extended_resource_name: The name of the base resource - :type extended_resource_name: str - :param adaptive_network_controls_resource_name: The name of the - Adaptive Network Controls resource. - :type adaptive_network_controls_resource_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AdaptiveNetworkControls or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.security.models.AdaptiveNetworkControls or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'extendedResourceProvider': self._serialize.url("extended_resource_provider", extended_resource_provider, 'str'), - 'extendedResourceType': self._serialize.url("extended_resource_type", extended_resource_type, 'str'), - 'extendedResourceName': self._serialize.url("extended_resource_name", extended_resource_name, 'str'), - 'adaptiveNetworkControlsResourceName': self._serialize.url("adaptive_network_controls_resource_name", adaptive_network_controls_resource_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AdaptiveNetworkControls', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/adaptiveNetworkControls/{adaptiveNetworkControlsResourceName}'} - - - def _enforce_initial( - self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, adaptive_network_controls_resource_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.enforce.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'extendedResourceProvider': self._serialize.url("extended_resource_provider", extended_resource_provider, 'str'), - 'extendedResourceType': self._serialize.url("extended_resource_type", extended_resource_type, 'str'), - 'extendedResourceName': self._serialize.url("extended_resource_name", extended_resource_name, 'str'), - 'adaptiveNetworkControlsResourceName': self._serialize.url("adaptive_network_controls_resource_name", adaptive_network_controls_resource_name, 'str'), - 'adaptiveNetworkControlsEnforceAction': self._serialize.url("self.adaptive_network_controls_enforce_action", self.adaptive_network_controls_enforce_action, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def enforce( - self, resource_group_name, extended_resource_provider, extended_resource_type, extended_resource_name, adaptive_network_controls_resource_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Enforces the given rules on the NSG(s) listed in the request. - - :param resource_group_name: The name of the resource group within the - user's subscription. The name is case insensitive. - :type resource_group_name: str - :param extended_resource_provider: Resource provider name of the base - resource - :type extended_resource_provider: str - :param extended_resource_type: Type of the base resource - :type extended_resource_type: str - :param extended_resource_name: The name of the base resource - :type extended_resource_name: str - :param adaptive_network_controls_resource_name: The name of the - Adaptive Network Controls resource. - :type adaptive_network_controls_resource_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._enforce_initial( - resource_group_name=resource_group_name, - extended_resource_provider=extended_resource_provider, - extended_resource_type=extended_resource_type, - extended_resource_name=extended_resource_name, - adaptive_network_controls_resource_name=adaptive_network_controls_resource_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - enforce.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{extendedResourceProvider}/{extendedResourceType}/{extendedResourceName}/providers/Microsoft.Security/adaptiveNetworkControls/{adaptiveNetworkControlsResourceName}/{adaptiveNetworkControlsEnforceAction}'} diff --git a/azure-mgmt-security/azure/mgmt/security/operations/alerts_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/alerts_operations.py index 9d7f01c1b7c6..d0d86845ded3 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/alerts_operations.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/alerts_operations.py @@ -23,7 +23,7 @@ class AlertsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: API version for the operation. Constant value: "2015-06-01-preview". + :ivar api_version: API version for the operation. Constant value: "2019-01-01". """ models = models @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-06-01-preview" + self.api_version = "2019-01-01" self.config = config diff --git a/azure-mgmt-security/azure/mgmt/security/operations/pricings_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/pricings_operations.py index 60cc30172f7e..85177f446714 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/pricings_operations.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/pricings_operations.py @@ -23,7 +23,7 @@ class PricingsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: API version for the operation. Constant value: "2017-08-01-preview". + :ivar api_version: API version for the operation. Constant value: "2018-06-01". """ models = models @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-08-01-preview" + self.api_version = "2018-06-01" self.config = config @@ -46,151 +46,15 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of Pricing - :rtype: - ~azure.mgmt.security.models.PricingPaged[~azure.mgmt.security.models.Pricing] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.PricingPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.PricingPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings'} - - def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Security pricing configurations in the resource group. - - :param resource_group_name: The name of the resource group within the - user's subscription. The name is case insensitive. - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Pricing - :rtype: - ~azure.mgmt.security.models.PricingPaged[~azure.mgmt.security.models.Pricing] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.PricingPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.PricingPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/pricings'} - - def get_subscription_pricing( - self, pricing_name, custom_headers=None, raw=False, **operation_config): - """Security pricing configuration in the subscriptionSecurity pricing - configuration in the subscription. - - :param pricing_name: name of the pricing configuration - :type pricing_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Pricing or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.security.models.Pricing or + :return: PricingList or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.PricingList or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ # Construct URL - url = self.get_subscription_pricing.metadata['url'] + url = self.list.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - 'pricingName': self._serialize.url("pricing_name", pricing_name, 'str') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$') } url = self._client.format_url(url, **path_format_arguments) @@ -220,90 +84,19 @@ def get_subscription_pricing( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Pricing', response) + deserialized = self._deserialize('PricingList', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_subscription_pricing.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings'} - def update_subscription_pricing( - self, pricing_name, pricing_tier, custom_headers=None, raw=False, **operation_config): + def get( + self, pricing_name, custom_headers=None, raw=False, **operation_config): """Security pricing configuration in the subscription. - :param pricing_name: name of the pricing configuration - :type pricing_name: str - :param pricing_tier: Pricing tier type. Possible values include: - 'Free', 'Standard' - :type pricing_tier: str or ~azure.mgmt.security.models.PricingTier - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Pricing or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.security.models.Pricing or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - pricing = models.Pricing(pricing_tier=pricing_tier) - - # Construct URL - url = self.update_subscription_pricing.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - 'pricingName': self._serialize.url("pricing_name", pricing_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(pricing, 'Pricing') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Pricing', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update_subscription_pricing.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}'} - - def get_resource_group_pricing( - self, resource_group_name, pricing_name, custom_headers=None, raw=False, **operation_config): - """Security pricing configuration in the resource group. - - :param resource_group_name: The name of the resource group within the - user's subscription. The name is case insensitive. - :type resource_group_name: str :param pricing_name: name of the pricing configuration :type pricing_name: str :param dict custom_headers: headers that will be added to the request @@ -317,10 +110,9 @@ def get_resource_group_pricing( :raises: :class:`CloudError` """ # Construct URL - url = self.get_resource_group_pricing.metadata['url'] + url = self.get.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'pricingName': self._serialize.url("pricing_name", pricing_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -358,18 +150,15 @@ def get_resource_group_pricing( return client_raw_response return deserialized - get_resource_group_pricing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/pricings/{pricingName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}'} - def create_or_update_resource_group_pricing( - self, resource_group_name, pricing_name, pricing_tier, custom_headers=None, raw=False, **operation_config): - """Security pricing configuration in the resource group. + def update( + self, pricing_name, pricing_tier, custom_headers=None, raw=False, **operation_config): + """Security pricing configuration in the subscription. - :param resource_group_name: The name of the resource group within the - user's subscription. The name is case insensitive. - :type resource_group_name: str :param pricing_name: name of the pricing configuration :type pricing_name: str - :param pricing_tier: Pricing tier type. Possible values include: + :param pricing_tier: The pricing tier value. Possible values include: 'Free', 'Standard' :type pricing_tier: str or ~azure.mgmt.security.models.PricingTier :param dict custom_headers: headers that will be added to the request @@ -385,10 +174,9 @@ def create_or_update_resource_group_pricing( pricing = models.Pricing(pricing_tier=pricing_tier) # Construct URL - url = self.create_or_update_resource_group_pricing.metadata['url'] + url = self.update.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'pricingName': self._serialize.url("pricing_name", pricing_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -430,4 +218,4 @@ def create_or_update_resource_group_pricing( return client_raw_response return deserialized - create_or_update_resource_group_pricing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/pricings/{pricingName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}'} diff --git a/azure-mgmt-security/azure/mgmt/security/operations/workspace_settings_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/workspace_settings_operations.py index d92f1831e26a..7c25fa3c51ab 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/workspace_settings_operations.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/workspace_settings_operations.py @@ -39,7 +39,9 @@ def __init__(self, client, config, serializer, deserializer): def list( self, custom_headers=None, raw=False, **operation_config): - """Settings about where we should store your security data and logs. + """Settings about where we should store your security data and logs. If + the result is empty, it means that no custom-workspace configuration + was set. :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -103,7 +105,9 @@ def internal_paging(next_link=None, raw=False): def get( self, workspace_setting_name, custom_headers=None, raw=False, **operation_config): - """Settings about where we should store your security data and logs. + """Settings about where we should store your security data and logs. If + the result is empty, it means that no custom-workspace configuration + was set. :param workspace_setting_name: Name of the security setting :type workspace_setting_name: str diff --git a/azure-mgmt-security/azure/mgmt/security/security_center.py b/azure-mgmt-security/azure/mgmt/security/security_center.py index d17e7db85e40..4a70b5762f4f 100644 --- a/azure-mgmt-security/azure/mgmt/security/security_center.py +++ b/azure-mgmt-security/azure/mgmt/security/security_center.py @@ -28,7 +28,6 @@ from .operations.discovered_security_solutions_operations import DiscoveredSecuritySolutionsOperations from .operations.jit_network_access_policies_operations import JitNetworkAccessPoliciesOperations from .operations.external_security_solutions_operations import ExternalSecuritySolutionsOperations -from .operations.adaptive_network_controls_operations import AdaptiveNetworkControlsOperations from .operations.topology_operations import TopologyOperations from .operations.allowed_connections_operations import AllowedConnectionsOperations from . import models @@ -108,8 +107,6 @@ class SecurityCenter(SDKClient): :vartype jit_network_access_policies: azure.mgmt.security.operations.JitNetworkAccessPoliciesOperations :ivar external_security_solutions: ExternalSecuritySolutions operations :vartype external_security_solutions: azure.mgmt.security.operations.ExternalSecuritySolutionsOperations - :ivar adaptive_network_controls: AdaptiveNetworkControls operations - :vartype adaptive_network_controls: azure.mgmt.security.operations.AdaptiveNetworkControlsOperations :ivar topology: Topology operations :vartype topology: azure.mgmt.security.operations.TopologyOperations :ivar allowed_connections: AllowedConnections operations @@ -166,8 +163,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.external_security_solutions = ExternalSecuritySolutionsOperations( self._client, self.config, self._serialize, self._deserialize) - self.adaptive_network_controls = AdaptiveNetworkControlsOperations( - self._client, self.config, self._serialize, self._deserialize) self.topology = TopologyOperations( self._client, self.config, self._serialize, self._deserialize) self.allowed_connections = AllowedConnectionsOperations( From 5d99dd3273073f69147e53107553e896b06aaf63 Mon Sep 17 00:00:00 2001 From: azuresdkci Date: Tue, 5 Mar 2019 15:04:16 +0000 Subject: [PATCH 08/11] Packaging update of azure-mgmt-security --- azure-mgmt-security/MANIFEST.in | 1 + azure-mgmt-security/README.rst | 19 ------------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/azure-mgmt-security/MANIFEST.in b/azure-mgmt-security/MANIFEST.in index 6ceb27f7a96e..e4884efef41b 100644 --- a/azure-mgmt-security/MANIFEST.in +++ b/azure-mgmt-security/MANIFEST.in @@ -1,3 +1,4 @@ +recursive-include tests *.py *.yaml include *.rst include azure/__init__.py include azure/mgmt/__init__.py diff --git a/azure-mgmt-security/README.rst b/azure-mgmt-security/README.rst index b2ad14672aa9..d61634454d3e 100644 --- a/azure-mgmt-security/README.rst +++ b/azure-mgmt-security/README.rst @@ -14,25 +14,6 @@ For the older Azure Service Management (ASM) libraries, see For a more complete set of Azure libraries, see the `azure `__ bundle package. -Compatibility -============= - -**IMPORTANT**: If you have an earlier version of the azure package -(version < 1.0), you should uninstall it before installing this package. - -You can check the version using pip: - -.. code:: shell - - pip freeze - -If you see azure==0.11.0 (or any version below 1.0), uninstall it first: - -.. code:: shell - - pip uninstall azure - - Usage ===== From 8be44f7a7bf36159daec757c99e5533b1e7da7c6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 25 Mar 2019 16:45:04 +0000 Subject: [PATCH 09/11] Generated from 0efd3e575484e7c34ea173274d8699bfdcd01608 Adding Adaptive Network Hardenings to Security readme.md --- .../azure/mgmt/security/models/__init__.py | 47 ++- .../models/adaptive_network_hardening.py | 59 ++++ ...ptive_network_hardening_enforce_request.py | 41 +++ ...e_network_hardening_enforce_request_py3.py | 41 +++ .../adaptive_network_hardening_paged.py | 27 ++ .../models/adaptive_network_hardening_py3.py | 59 ++++ .../azure/mgmt/security/models/alert.py | 6 + .../azure/mgmt/security/models/alert_py3.py | 6 + .../effective_network_security_groups.py | 33 ++ .../effective_network_security_groups_py3.py | 33 ++ .../regulatory_compliance_assessment.py | 89 ++++++ .../regulatory_compliance_assessment_paged.py | 27 ++ .../regulatory_compliance_assessment_py3.py | 89 ++++++ .../models/regulatory_compliance_control.py | 71 +++++ .../regulatory_compliance_control_paged.py | 27 ++ .../regulatory_compliance_control_py3.py | 71 +++++ .../models/regulatory_compliance_standard.py | 72 +++++ .../regulatory_compliance_standard_paged.py | 27 ++ .../regulatory_compliance_standard_py3.py | 72 +++++ .../azure/mgmt/security/models/rule.py | 50 +++ .../azure/mgmt/security/models/rule_py3.py | 50 +++ .../security/models/security_center_enums.py | 20 ++ .../mgmt/security/operations/__init__.py | 8 + .../adaptive_network_hardenings_operations.py | 301 ++++++++++++++++++ ...atory_compliance_assessments_operations.py | 193 +++++++++++ ...gulatory_compliance_controls_operations.py | 183 +++++++++++ ...ulatory_compliance_standards_operations.py | 174 ++++++++++ .../azure/mgmt/security/security_center.py | 20 ++ 28 files changed, 1890 insertions(+), 6 deletions(-) create mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_enforce_request.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_enforce_request_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_paged.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/effective_network_security_groups.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/effective_network_security_groups_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment_paged.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control_paged.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard_paged.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/rule.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/rule_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_hardenings_operations.py create mode 100644 azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_assessments_operations.py create mode 100644 azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_controls_operations.py create mode 100644 azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_standards_operations.py diff --git a/azure-mgmt-security/azure/mgmt/security/models/__init__.py b/azure-mgmt-security/azure/mgmt/security/models/__init__.py index b72e7878ab32..eddf3521a904 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/models/__init__.py @@ -10,10 +10,13 @@ # -------------------------------------------------------------------------- try: - from .pricing_py3 import Pricing - from .pricing_list_py3 import PricingList + from .regulatory_compliance_standard_py3 import RegulatoryComplianceStandard + from .regulatory_compliance_control_py3 import RegulatoryComplianceControl + from .regulatory_compliance_assessment_py3 import RegulatoryComplianceAssessment from .asc_location_py3 import AscLocation from .resource_py3 import Resource + from .pricing_py3 import Pricing + from .pricing_list_py3 import PricingList from .security_contact_py3 import SecurityContact from .workspace_setting_py3 import WorkspaceSetting from .auto_provisioning_setting_py3 import AutoProvisioningSetting @@ -64,11 +67,18 @@ from .connected_resource_py3 import ConnectedResource from .connectable_resource_py3 import ConnectableResource from .allowed_connections_resource_py3 import AllowedConnectionsResource + from .rule_py3 import Rule + from .effective_network_security_groups_py3 import EffectiveNetworkSecurityGroups + from .adaptive_network_hardening_py3 import AdaptiveNetworkHardening + from .adaptive_network_hardening_enforce_request_py3 import AdaptiveNetworkHardeningEnforceRequest except (SyntaxError, ImportError): - from .pricing import Pricing - from .pricing_list import PricingList + from .regulatory_compliance_standard import RegulatoryComplianceStandard + from .regulatory_compliance_control import RegulatoryComplianceControl + from .regulatory_compliance_assessment import RegulatoryComplianceAssessment from .asc_location import AscLocation from .resource import Resource + from .pricing import Pricing + from .pricing_list import PricingList from .security_contact import SecurityContact from .workspace_setting import WorkspaceSetting from .auto_provisioning_setting import AutoProvisioningSetting @@ -119,6 +129,13 @@ from .connected_resource import ConnectedResource from .connectable_resource import ConnectableResource from .allowed_connections_resource import AllowedConnectionsResource + from .rule import Rule + from .effective_network_security_groups import EffectiveNetworkSecurityGroups + from .adaptive_network_hardening import AdaptiveNetworkHardening + from .adaptive_network_hardening_enforce_request import AdaptiveNetworkHardeningEnforceRequest +from .regulatory_compliance_standard_paged import RegulatoryComplianceStandardPaged +from .regulatory_compliance_control_paged import RegulatoryComplianceControlPaged +from .regulatory_compliance_assessment_paged import RegulatoryComplianceAssessmentPaged from .security_contact_paged import SecurityContactPaged from .workspace_setting_paged import WorkspaceSettingPaged from .auto_provisioning_setting_paged import AutoProvisioningSettingPaged @@ -134,7 +151,9 @@ from .external_security_solution_paged import ExternalSecuritySolutionPaged from .topology_resource_paged import TopologyResourcePaged from .allowed_connections_resource_paged import AllowedConnectionsResourcePaged +from .adaptive_network_hardening_paged import AdaptiveNetworkHardeningPaged from .security_center_enums import ( + State, PricingTier, AlertNotifications, AlertsToAdmins, @@ -147,14 +166,19 @@ StatusReason, AadConnectivityState, ExternalSecuritySolutionKind, + Direction, + TransportProtocol, ConnectionType, ) __all__ = [ - 'Pricing', - 'PricingList', + 'RegulatoryComplianceStandard', + 'RegulatoryComplianceControl', + 'RegulatoryComplianceAssessment', 'AscLocation', 'Resource', + 'Pricing', + 'PricingList', 'SecurityContact', 'WorkspaceSetting', 'AutoProvisioningSetting', @@ -205,6 +229,13 @@ 'ConnectedResource', 'ConnectableResource', 'AllowedConnectionsResource', + 'Rule', + 'EffectiveNetworkSecurityGroups', + 'AdaptiveNetworkHardening', + 'AdaptiveNetworkHardeningEnforceRequest', + 'RegulatoryComplianceStandardPaged', + 'RegulatoryComplianceControlPaged', + 'RegulatoryComplianceAssessmentPaged', 'SecurityContactPaged', 'WorkspaceSettingPaged', 'AutoProvisioningSettingPaged', @@ -220,6 +251,8 @@ 'ExternalSecuritySolutionPaged', 'TopologyResourcePaged', 'AllowedConnectionsResourcePaged', + 'AdaptiveNetworkHardeningPaged', + 'State', 'PricingTier', 'AlertNotifications', 'AlertsToAdmins', @@ -232,5 +265,7 @@ 'StatusReason', 'AadConnectivityState', 'ExternalSecuritySolutionKind', + 'Direction', + 'TransportProtocol', 'ConnectionType', ] diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening.py new file mode 100644 index 000000000000..3f81c1a374d4 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class AdaptiveNetworkHardening(Resource): + """The resource whose properties describes the Adaptive Network Hardening + settings for some Azure resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param rules: The security rules which are recommended to be effective on + the VM + :type rules: list[~azure.mgmt.security.models.Rule] + :param rules_calculation_time: The UTC time on which the rules were + calculated + :type rules_calculation_time: datetime + :param effective_network_security_groups: The Network Security Groups + effective on the network interfaces of the protected resource + :type effective_network_security_groups: + list[~azure.mgmt.security.models.EffectiveNetworkSecurityGroups] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'properties.rules', 'type': '[Rule]'}, + 'rules_calculation_time': {'key': 'properties.rulesCalculationTime', 'type': 'iso-8601'}, + 'effective_network_security_groups': {'key': 'properties.effectiveNetworkSecurityGroups', 'type': '[EffectiveNetworkSecurityGroups]'}, + } + + def __init__(self, **kwargs): + super(AdaptiveNetworkHardening, self).__init__(**kwargs) + self.rules = kwargs.get('rules', None) + self.rules_calculation_time = kwargs.get('rules_calculation_time', None) + self.effective_network_security_groups = kwargs.get('effective_network_security_groups', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_enforce_request.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_enforce_request.py new file mode 100644 index 000000000000..6faffd9aed18 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_enforce_request.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AdaptiveNetworkHardeningEnforceRequest(Model): + """AdaptiveNetworkHardeningEnforceRequest. + + All required parameters must be populated in order to send to Azure. + + :param rules: Required. The rules to enforce + :type rules: list[~azure.mgmt.security.models.Rule] + :param network_security_groups: Required. The Azure resource IDs of the + effective network security groups that will be updated with the created + security rules from the Adaptive Network Hardening rules + :type network_security_groups: list[str] + """ + + _validation = { + 'rules': {'required': True}, + 'network_security_groups': {'required': True}, + } + + _attribute_map = { + 'rules': {'key': 'rules', 'type': '[Rule]'}, + 'network_security_groups': {'key': 'networkSecurityGroups', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(AdaptiveNetworkHardeningEnforceRequest, self).__init__(**kwargs) + self.rules = kwargs.get('rules', None) + self.network_security_groups = kwargs.get('network_security_groups', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_enforce_request_py3.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_enforce_request_py3.py new file mode 100644 index 000000000000..710b2cc86f29 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_enforce_request_py3.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AdaptiveNetworkHardeningEnforceRequest(Model): + """AdaptiveNetworkHardeningEnforceRequest. + + All required parameters must be populated in order to send to Azure. + + :param rules: Required. The rules to enforce + :type rules: list[~azure.mgmt.security.models.Rule] + :param network_security_groups: Required. The Azure resource IDs of the + effective network security groups that will be updated with the created + security rules from the Adaptive Network Hardening rules + :type network_security_groups: list[str] + """ + + _validation = { + 'rules': {'required': True}, + 'network_security_groups': {'required': True}, + } + + _attribute_map = { + 'rules': {'key': 'rules', 'type': '[Rule]'}, + 'network_security_groups': {'key': 'networkSecurityGroups', 'type': '[str]'}, + } + + def __init__(self, *, rules, network_security_groups, **kwargs) -> None: + super(AdaptiveNetworkHardeningEnforceRequest, self).__init__(**kwargs) + self.rules = rules + self.network_security_groups = network_security_groups diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_paged.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_paged.py new file mode 100644 index 000000000000..c4deebc9097a --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class AdaptiveNetworkHardeningPaged(Paged): + """ + A paging container for iterating over a list of :class:`AdaptiveNetworkHardening ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AdaptiveNetworkHardening]'} + } + + def __init__(self, *args, **kwargs): + + super(AdaptiveNetworkHardeningPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_py3.py b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_py3.py new file mode 100644 index 000000000000..37722f51e2af --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/adaptive_network_hardening_py3.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource_py3 import Resource + + +class AdaptiveNetworkHardening(Resource): + """The resource whose properties describes the Adaptive Network Hardening + settings for some Azure resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param rules: The security rules which are recommended to be effective on + the VM + :type rules: list[~azure.mgmt.security.models.Rule] + :param rules_calculation_time: The UTC time on which the rules were + calculated + :type rules_calculation_time: datetime + :param effective_network_security_groups: The Network Security Groups + effective on the network interfaces of the protected resource + :type effective_network_security_groups: + list[~azure.mgmt.security.models.EffectiveNetworkSecurityGroups] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'properties.rules', 'type': '[Rule]'}, + 'rules_calculation_time': {'key': 'properties.rulesCalculationTime', 'type': 'iso-8601'}, + 'effective_network_security_groups': {'key': 'properties.effectiveNetworkSecurityGroups', 'type': '[EffectiveNetworkSecurityGroups]'}, + } + + def __init__(self, *, rules=None, rules_calculation_time=None, effective_network_security_groups=None, **kwargs) -> None: + super(AdaptiveNetworkHardening, self).__init__(**kwargs) + self.rules = rules + self.rules_calculation_time = rules_calculation_time + self.effective_network_security_groups = effective_network_security_groups diff --git a/azure-mgmt-security/azure/mgmt/security/models/alert.py b/azure-mgmt-security/azure/mgmt/security/models/alert.py index 965e5877b722..a467fe8ffcbb 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/alert.py +++ b/azure-mgmt-security/azure/mgmt/security/models/alert.py @@ -78,6 +78,9 @@ class Alert(Resource): :ivar workspace_arm_id: Azure resource ID of the workspace that the alert was reported to. :vartype workspace_arm_id: str + :ivar correlation_key: Alerts with the same CorrelationKey will be grouped + together in Ibiza. + :vartype correlation_key: str """ _validation = { @@ -103,6 +106,7 @@ class Alert(Resource): 'subscription_id': {'readonly': True}, 'instance_id': {'readonly': True}, 'workspace_arm_id': {'readonly': True}, + 'correlation_key': {'readonly': True}, } _attribute_map = { @@ -131,6 +135,7 @@ class Alert(Resource): 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, 'instance_id': {'key': 'properties.instanceId', 'type': 'str'}, 'workspace_arm_id': {'key': 'properties.workspaceArmId', 'type': 'str'}, + 'correlation_key': {'key': 'properties.correlationKey', 'type': 'str'}, } def __init__(self, **kwargs): @@ -157,3 +162,4 @@ def __init__(self, **kwargs): self.subscription_id = None self.instance_id = None self.workspace_arm_id = None + self.correlation_key = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/alert_py3.py b/azure-mgmt-security/azure/mgmt/security/models/alert_py3.py index c73685113d7a..95007f9bb77a 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/alert_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/alert_py3.py @@ -78,6 +78,9 @@ class Alert(Resource): :ivar workspace_arm_id: Azure resource ID of the workspace that the alert was reported to. :vartype workspace_arm_id: str + :ivar correlation_key: Alerts with the same CorrelationKey will be grouped + together in Ibiza. + :vartype correlation_key: str """ _validation = { @@ -103,6 +106,7 @@ class Alert(Resource): 'subscription_id': {'readonly': True}, 'instance_id': {'readonly': True}, 'workspace_arm_id': {'readonly': True}, + 'correlation_key': {'readonly': True}, } _attribute_map = { @@ -131,6 +135,7 @@ class Alert(Resource): 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, 'instance_id': {'key': 'properties.instanceId', 'type': 'str'}, 'workspace_arm_id': {'key': 'properties.workspaceArmId', 'type': 'str'}, + 'correlation_key': {'key': 'properties.correlationKey', 'type': 'str'}, } def __init__(self, *, extended_properties=None, entities=None, confidence_reasons=None, **kwargs) -> None: @@ -157,3 +162,4 @@ def __init__(self, *, extended_properties=None, entities=None, confidence_reason self.subscription_id = None self.instance_id = None self.workspace_arm_id = None + self.correlation_key = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/effective_network_security_groups.py b/azure-mgmt-security/azure/mgmt/security/models/effective_network_security_groups.py new file mode 100644 index 000000000000..20047e2b190f --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/effective_network_security_groups.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EffectiveNetworkSecurityGroups(Model): + """Describes the Network Security Groups effective on a network interface. + + :param network_interface: The Azure resource ID of the network interface + :type network_interface: str + :param network_security_groups: The Network Security Groups effective on + the network interface + :type network_security_groups: list[str] + """ + + _attribute_map = { + 'network_interface': {'key': 'networkInterface', 'type': 'str'}, + 'network_security_groups': {'key': 'networkSecurityGroups', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(EffectiveNetworkSecurityGroups, self).__init__(**kwargs) + self.network_interface = kwargs.get('network_interface', None) + self.network_security_groups = kwargs.get('network_security_groups', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/effective_network_security_groups_py3.py b/azure-mgmt-security/azure/mgmt/security/models/effective_network_security_groups_py3.py new file mode 100644 index 000000000000..9779ead3fc8c --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/effective_network_security_groups_py3.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EffectiveNetworkSecurityGroups(Model): + """Describes the Network Security Groups effective on a network interface. + + :param network_interface: The Azure resource ID of the network interface + :type network_interface: str + :param network_security_groups: The Network Security Groups effective on + the network interface + :type network_security_groups: list[str] + """ + + _attribute_map = { + 'network_interface': {'key': 'networkInterface', 'type': 'str'}, + 'network_security_groups': {'key': 'networkSecurityGroups', 'type': '[str]'}, + } + + def __init__(self, *, network_interface: str=None, network_security_groups=None, **kwargs) -> None: + super(EffectiveNetworkSecurityGroups, self).__init__(**kwargs) + self.network_interface = network_interface + self.network_security_groups = network_security_groups diff --git a/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment.py b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment.py new file mode 100644 index 000000000000..471302606092 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class RegulatoryComplianceAssessment(Resource): + """Regulatory compliance assessment details and state. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :ivar description: The description of the regulatory compliance assessment + :vartype description: str + :ivar assessment_type: The expected type of assessment contained in the + AssessmentDetailsLink + :vartype assessment_type: str + :ivar assessment_details_link: Link to more detailed assessment results + data. The response type will be according to the assessmentType field + :vartype assessment_details_link: str + :param state: Aggregative state based on the assessment's scanned + resources states. Possible values include: 'Passed', 'Failed', 'Skipped', + 'Unsupported' + :type state: str or ~azure.mgmt.security.models.State + :ivar passed_resources: The given assessment's related resources count + with passed state. + :vartype passed_resources: int + :ivar failed_resources: The given assessment's related resources count + with failed state. + :vartype failed_resources: int + :ivar skipped_resources: The given assessment's related resources count + with skipped state. + :vartype skipped_resources: int + :ivar unsupported_resources: The given assessment's related resources + count with unsupported state. + :vartype unsupported_resources: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'assessment_type': {'readonly': True}, + 'assessment_details_link': {'readonly': True}, + 'passed_resources': {'readonly': True}, + 'failed_resources': {'readonly': True}, + 'skipped_resources': {'readonly': True}, + 'unsupported_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'assessment_type': {'key': 'properties.assessmentType', 'type': 'str'}, + 'assessment_details_link': {'key': 'properties.assessmentDetailsLink', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'passed_resources': {'key': 'properties.passedResources', 'type': 'int'}, + 'failed_resources': {'key': 'properties.failedResources', 'type': 'int'}, + 'skipped_resources': {'key': 'properties.skippedResources', 'type': 'int'}, + 'unsupported_resources': {'key': 'properties.unsupportedResources', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(RegulatoryComplianceAssessment, self).__init__(**kwargs) + self.description = None + self.assessment_type = None + self.assessment_details_link = None + self.state = kwargs.get('state', None) + self.passed_resources = None + self.failed_resources = None + self.skipped_resources = None + self.unsupported_resources = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment_paged.py b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment_paged.py new file mode 100644 index 000000000000..f5661a66b539 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RegulatoryComplianceAssessmentPaged(Paged): + """ + A paging container for iterating over a list of :class:`RegulatoryComplianceAssessment ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RegulatoryComplianceAssessment]'} + } + + def __init__(self, *args, **kwargs): + + super(RegulatoryComplianceAssessmentPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment_py3.py b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment_py3.py new file mode 100644 index 000000000000..92bad19c1805 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_assessment_py3.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource_py3 import Resource + + +class RegulatoryComplianceAssessment(Resource): + """Regulatory compliance assessment details and state. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :ivar description: The description of the regulatory compliance assessment + :vartype description: str + :ivar assessment_type: The expected type of assessment contained in the + AssessmentDetailsLink + :vartype assessment_type: str + :ivar assessment_details_link: Link to more detailed assessment results + data. The response type will be according to the assessmentType field + :vartype assessment_details_link: str + :param state: Aggregative state based on the assessment's scanned + resources states. Possible values include: 'Passed', 'Failed', 'Skipped', + 'Unsupported' + :type state: str or ~azure.mgmt.security.models.State + :ivar passed_resources: The given assessment's related resources count + with passed state. + :vartype passed_resources: int + :ivar failed_resources: The given assessment's related resources count + with failed state. + :vartype failed_resources: int + :ivar skipped_resources: The given assessment's related resources count + with skipped state. + :vartype skipped_resources: int + :ivar unsupported_resources: The given assessment's related resources + count with unsupported state. + :vartype unsupported_resources: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'assessment_type': {'readonly': True}, + 'assessment_details_link': {'readonly': True}, + 'passed_resources': {'readonly': True}, + 'failed_resources': {'readonly': True}, + 'skipped_resources': {'readonly': True}, + 'unsupported_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'assessment_type': {'key': 'properties.assessmentType', 'type': 'str'}, + 'assessment_details_link': {'key': 'properties.assessmentDetailsLink', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'passed_resources': {'key': 'properties.passedResources', 'type': 'int'}, + 'failed_resources': {'key': 'properties.failedResources', 'type': 'int'}, + 'skipped_resources': {'key': 'properties.skippedResources', 'type': 'int'}, + 'unsupported_resources': {'key': 'properties.unsupportedResources', 'type': 'int'}, + } + + def __init__(self, *, state=None, **kwargs) -> None: + super(RegulatoryComplianceAssessment, self).__init__(**kwargs) + self.description = None + self.assessment_type = None + self.assessment_details_link = None + self.state = state + self.passed_resources = None + self.failed_resources = None + self.skipped_resources = None + self.unsupported_resources = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control.py b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control.py new file mode 100644 index 000000000000..ab7accd57683 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class RegulatoryComplianceControl(Resource): + """Regulatory compliance control details and state. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :ivar description: The description of the regulatory compliance control + :vartype description: str + :param state: Aggregative state based on the control's supported + assessments states. Possible values include: 'Passed', 'Failed', + 'Skipped', 'Unsupported' + :type state: str or ~azure.mgmt.security.models.State + :ivar passed_assessments: The number of supported regulatory compliance + assessments of the given control with a passed state + :vartype passed_assessments: int + :ivar failed_assessments: The number of supported regulatory compliance + assessments of the given control with a failed state + :vartype failed_assessments: int + :ivar skipped_assessments: The number of supported regulatory compliance + assessments of the given control with a skipped state + :vartype skipped_assessments: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'passed_assessments': {'readonly': True}, + 'failed_assessments': {'readonly': True}, + 'skipped_assessments': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'passed_assessments': {'key': 'properties.passedAssessments', 'type': 'int'}, + 'failed_assessments': {'key': 'properties.failedAssessments', 'type': 'int'}, + 'skipped_assessments': {'key': 'properties.skippedAssessments', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(RegulatoryComplianceControl, self).__init__(**kwargs) + self.description = None + self.state = kwargs.get('state', None) + self.passed_assessments = None + self.failed_assessments = None + self.skipped_assessments = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control_paged.py b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control_paged.py new file mode 100644 index 000000000000..22210d83bc43 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RegulatoryComplianceControlPaged(Paged): + """ + A paging container for iterating over a list of :class:`RegulatoryComplianceControl ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RegulatoryComplianceControl]'} + } + + def __init__(self, *args, **kwargs): + + super(RegulatoryComplianceControlPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control_py3.py b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control_py3.py new file mode 100644 index 000000000000..0eaf9208895c --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_control_py3.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource_py3 import Resource + + +class RegulatoryComplianceControl(Resource): + """Regulatory compliance control details and state. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :ivar description: The description of the regulatory compliance control + :vartype description: str + :param state: Aggregative state based on the control's supported + assessments states. Possible values include: 'Passed', 'Failed', + 'Skipped', 'Unsupported' + :type state: str or ~azure.mgmt.security.models.State + :ivar passed_assessments: The number of supported regulatory compliance + assessments of the given control with a passed state + :vartype passed_assessments: int + :ivar failed_assessments: The number of supported regulatory compliance + assessments of the given control with a failed state + :vartype failed_assessments: int + :ivar skipped_assessments: The number of supported regulatory compliance + assessments of the given control with a skipped state + :vartype skipped_assessments: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'passed_assessments': {'readonly': True}, + 'failed_assessments': {'readonly': True}, + 'skipped_assessments': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'passed_assessments': {'key': 'properties.passedAssessments', 'type': 'int'}, + 'failed_assessments': {'key': 'properties.failedAssessments', 'type': 'int'}, + 'skipped_assessments': {'key': 'properties.skippedAssessments', 'type': 'int'}, + } + + def __init__(self, *, state=None, **kwargs) -> None: + super(RegulatoryComplianceControl, self).__init__(**kwargs) + self.description = None + self.state = state + self.passed_assessments = None + self.failed_assessments = None + self.skipped_assessments = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard.py b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard.py new file mode 100644 index 000000000000..052a8a90edbc --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class RegulatoryComplianceStandard(Resource): + """Regulatory compliance standard details and state. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param state: Aggregative state based on the standard's supported controls + states. Possible values include: 'Passed', 'Failed', 'Skipped', + 'Unsupported' + :type state: str or ~azure.mgmt.security.models.State + :ivar passed_controls: The number of supported regulatory compliance + controls of the given standard with a passed state + :vartype passed_controls: int + :ivar failed_controls: The number of supported regulatory compliance + controls of the given standard with a failed state + :vartype failed_controls: int + :ivar skipped_controls: The number of supported regulatory compliance + controls of the given standard with a skipped state + :vartype skipped_controls: int + :ivar unsupported_controls: The number of regulatory compliance controls + of the given standard which are unsupported by automated assessments + :vartype unsupported_controls: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'passed_controls': {'readonly': True}, + 'failed_controls': {'readonly': True}, + 'skipped_controls': {'readonly': True}, + 'unsupported_controls': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'passed_controls': {'key': 'properties.passedControls', 'type': 'int'}, + 'failed_controls': {'key': 'properties.failedControls', 'type': 'int'}, + 'skipped_controls': {'key': 'properties.skippedControls', 'type': 'int'}, + 'unsupported_controls': {'key': 'properties.unsupportedControls', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(RegulatoryComplianceStandard, self).__init__(**kwargs) + self.state = kwargs.get('state', None) + self.passed_controls = None + self.failed_controls = None + self.skipped_controls = None + self.unsupported_controls = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard_paged.py b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard_paged.py new file mode 100644 index 000000000000..8f091eee07be --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RegulatoryComplianceStandardPaged(Paged): + """ + A paging container for iterating over a list of :class:`RegulatoryComplianceStandard ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RegulatoryComplianceStandard]'} + } + + def __init__(self, *args, **kwargs): + + super(RegulatoryComplianceStandardPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard_py3.py b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard_py3.py new file mode 100644 index 000000000000..9abfdccc46f2 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/regulatory_compliance_standard_py3.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource_py3 import Resource + + +class RegulatoryComplianceStandard(Resource): + """Regulatory compliance standard details and state. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param state: Aggregative state based on the standard's supported controls + states. Possible values include: 'Passed', 'Failed', 'Skipped', + 'Unsupported' + :type state: str or ~azure.mgmt.security.models.State + :ivar passed_controls: The number of supported regulatory compliance + controls of the given standard with a passed state + :vartype passed_controls: int + :ivar failed_controls: The number of supported regulatory compliance + controls of the given standard with a failed state + :vartype failed_controls: int + :ivar skipped_controls: The number of supported regulatory compliance + controls of the given standard with a skipped state + :vartype skipped_controls: int + :ivar unsupported_controls: The number of regulatory compliance controls + of the given standard which are unsupported by automated assessments + :vartype unsupported_controls: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'passed_controls': {'readonly': True}, + 'failed_controls': {'readonly': True}, + 'skipped_controls': {'readonly': True}, + 'unsupported_controls': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'passed_controls': {'key': 'properties.passedControls', 'type': 'int'}, + 'failed_controls': {'key': 'properties.failedControls', 'type': 'int'}, + 'skipped_controls': {'key': 'properties.skippedControls', 'type': 'int'}, + 'unsupported_controls': {'key': 'properties.unsupportedControls', 'type': 'int'}, + } + + def __init__(self, *, state=None, **kwargs) -> None: + super(RegulatoryComplianceStandard, self).__init__(**kwargs) + self.state = state + self.passed_controls = None + self.failed_controls = None + self.skipped_controls = None + self.unsupported_controls = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/rule.py b/azure-mgmt-security/azure/mgmt/security/models/rule.py new file mode 100644 index 000000000000..422828637300 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/rule.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Rule(Model): + """Describes remote addresses that is recommended to communicate with the + Azure resource on some (Protocol, Port, Direction). All other remote + addresses are recommended to be blocked. + + :param name: The name of the rule + :type name: str + :param direction: The rule's direction. Possible values include: + 'Inbound', 'Outbound' + :type direction: str or ~azure.mgmt.security.models.Direction + :param destination_port: The rule's destination port + :type destination_port: int + :param protocols: The rule's transport protocols + :type protocols: list[str or + ~azure.mgmt.security.models.TransportProtocol] + :param ip_addresses: The remote IP addresses that should be able to + communicate with the Azure resource on the rule's destination port and + protocol + :type ip_addresses: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'direction': {'key': 'direction', 'type': 'str'}, + 'destination_port': {'key': 'destinationPort', 'type': 'int'}, + 'protocols': {'key': 'protocols', 'type': '[str]'}, + 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(Rule, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.direction = kwargs.get('direction', None) + self.destination_port = kwargs.get('destination_port', None) + self.protocols = kwargs.get('protocols', None) + self.ip_addresses = kwargs.get('ip_addresses', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/rule_py3.py b/azure-mgmt-security/azure/mgmt/security/models/rule_py3.py new file mode 100644 index 000000000000..8f5eef4853f4 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/rule_py3.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Rule(Model): + """Describes remote addresses that is recommended to communicate with the + Azure resource on some (Protocol, Port, Direction). All other remote + addresses are recommended to be blocked. + + :param name: The name of the rule + :type name: str + :param direction: The rule's direction. Possible values include: + 'Inbound', 'Outbound' + :type direction: str or ~azure.mgmt.security.models.Direction + :param destination_port: The rule's destination port + :type destination_port: int + :param protocols: The rule's transport protocols + :type protocols: list[str or + ~azure.mgmt.security.models.TransportProtocol] + :param ip_addresses: The remote IP addresses that should be able to + communicate with the Azure resource on the rule's destination port and + protocol + :type ip_addresses: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'direction': {'key': 'direction', 'type': 'str'}, + 'destination_port': {'key': 'destinationPort', 'type': 'int'}, + 'protocols': {'key': 'protocols', 'type': '[str]'}, + 'ip_addresses': {'key': 'ipAddresses', 'type': '[str]'}, + } + + def __init__(self, *, name: str=None, direction=None, destination_port: int=None, protocols=None, ip_addresses=None, **kwargs) -> None: + super(Rule, self).__init__(**kwargs) + self.name = name + self.direction = direction + self.destination_port = destination_port + self.protocols = protocols + self.ip_addresses = ip_addresses diff --git a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py index 6c105302e027..34e12e448ae1 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py +++ b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py @@ -12,6 +12,14 @@ from enum import Enum +class State(str, Enum): + + passed = "Passed" #: All supported regulatory compliance controls in the given standard have a passed state + failed = "Failed" #: At least one supported regulatory compliance control in the given standard has a state of failed + skipped = "Skipped" #: All supported regulatory compliance controls in the given standard have a state of skipped + unsupported = "Unsupported" #: No supported regulatory compliance data for the given standard + + class PricingTier(str, Enum): free = "Free" #: Get free Azure security center experience with basic security features @@ -92,6 +100,18 @@ class ExternalSecuritySolutionKind(str, Enum): aad = "AAD" +class Direction(str, Enum): + + inbound = "Inbound" + outbound = "Outbound" + + +class TransportProtocol(str, Enum): + + tcp = "TCP" + udp = "UDP" + + class ConnectionType(str, Enum): internal = "Internal" diff --git a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py index cc451ba3dd54..5f3a089a1888 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py @@ -9,6 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- +from .regulatory_compliance_standards_operations import RegulatoryComplianceStandardsOperations +from .regulatory_compliance_controls_operations import RegulatoryComplianceControlsOperations +from .regulatory_compliance_assessments_operations import RegulatoryComplianceAssessmentsOperations from .pricings_operations import PricingsOperations from .security_contacts_operations import SecurityContactsOperations from .workspace_settings_operations import WorkspaceSettingsOperations @@ -26,8 +29,12 @@ from .external_security_solutions_operations import ExternalSecuritySolutionsOperations from .topology_operations import TopologyOperations from .allowed_connections_operations import AllowedConnectionsOperations +from .adaptive_network_hardenings_operations import AdaptiveNetworkHardeningsOperations __all__ = [ + 'RegulatoryComplianceStandardsOperations', + 'RegulatoryComplianceControlsOperations', + 'RegulatoryComplianceAssessmentsOperations', 'PricingsOperations', 'SecurityContactsOperations', 'WorkspaceSettingsOperations', @@ -45,4 +52,5 @@ 'ExternalSecuritySolutionsOperations', 'TopologyOperations', 'AllowedConnectionsOperations', + 'AdaptiveNetworkHardeningsOperations', ] diff --git a/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_hardenings_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_hardenings_operations.py new file mode 100644 index 000000000000..0f41d973ee73 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/operations/adaptive_network_hardenings_operations.py @@ -0,0 +1,301 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class AdaptiveNetworkHardeningsOperations(object): + """AdaptiveNetworkHardeningsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: API version for the operation. Constant value: "2015-06-01-preview". + :ivar adaptive_network_hardening_enforce_action: Enforces the given rules on the NSG(s) listed in the request. Constant value: "enforce". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-06-01-preview" + self.adaptive_network_hardening_enforce_action = "enforce" + + self.config = config + + def list_by_extended_resource( + self, resource_group_name, resource_namespace, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of Adaptive Network Hardenings resources in scope of an + extended resource. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param resource_namespace: The Namespace of the resource. + :type resource_namespace: str + :param resource_type: The type of the resource. + :type resource_type: str + :param resource_name: Name of the resource. + :type resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AdaptiveNetworkHardening + :rtype: + ~azure.mgmt.security.models.AdaptiveNetworkHardeningPaged[~azure.mgmt.security.models.AdaptiveNetworkHardening] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_extended_resource.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceNamespace': self._serialize.url("resource_namespace", resource_namespace, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.AdaptiveNetworkHardeningPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.AdaptiveNetworkHardeningPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_extended_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings'} + + def get( + self, resource_group_name, resource_namespace, resource_type, resource_name, adaptive_network_hardening_resource_name, custom_headers=None, raw=False, **operation_config): + """Gets a single Adaptive Network Hardening resource. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param resource_namespace: The Namespace of the resource. + :type resource_namespace: str + :param resource_type: The type of the resource. + :type resource_type: str + :param resource_name: Name of the resource. + :type resource_name: str + :param adaptive_network_hardening_resource_name: The name of the + Adaptive Network Hardening resource. + :type adaptive_network_hardening_resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AdaptiveNetworkHardening or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.AdaptiveNetworkHardening or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceNamespace': self._serialize.url("resource_namespace", resource_namespace, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'adaptiveNetworkHardeningResourceName': self._serialize.url("adaptive_network_hardening_resource_name", adaptive_network_hardening_resource_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AdaptiveNetworkHardening', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}'} + + + def _enforce_initial( + self, resource_group_name, resource_namespace, resource_type, resource_name, adaptive_network_hardening_resource_name, rules, network_security_groups, custom_headers=None, raw=False, **operation_config): + body = models.AdaptiveNetworkHardeningEnforceRequest(rules=rules, network_security_groups=network_security_groups) + + # Construct URL + url = self.enforce.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceNamespace': self._serialize.url("resource_namespace", resource_namespace, 'str'), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'adaptiveNetworkHardeningResourceName': self._serialize.url("adaptive_network_hardening_resource_name", adaptive_network_hardening_resource_name, 'str'), + 'adaptiveNetworkHardeningEnforceAction': self._serialize.url("self.adaptive_network_hardening_enforce_action", self.adaptive_network_hardening_enforce_action, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, 'AdaptiveNetworkHardeningEnforceRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def enforce( + self, resource_group_name, resource_namespace, resource_type, resource_name, adaptive_network_hardening_resource_name, rules, network_security_groups, custom_headers=None, raw=False, polling=True, **operation_config): + """Enforces the given rules on the NSG(s) listed in the request. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param resource_namespace: The Namespace of the resource. + :type resource_namespace: str + :param resource_type: The type of the resource. + :type resource_type: str + :param resource_name: Name of the resource. + :type resource_name: str + :param adaptive_network_hardening_resource_name: The name of the + Adaptive Network Hardening resource. + :type adaptive_network_hardening_resource_name: str + :param rules: The rules to enforce + :type rules: list[~azure.mgmt.security.models.Rule] + :param network_security_groups: The Azure resource IDs of the + effective network security groups that will be updated with the + created security rules from the Adaptive Network Hardening rules + :type network_security_groups: list[str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._enforce_initial( + resource_group_name=resource_group_name, + resource_namespace=resource_namespace, + resource_type=resource_type, + resource_name=resource_name, + adaptive_network_hardening_resource_name=adaptive_network_hardening_resource_name, + rules=rules, + network_security_groups=network_security_groups, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + enforce.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}'} diff --git a/azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_assessments_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_assessments_operations.py new file mode 100644 index 000000000000..afc2c6d0adfd --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_assessments_operations.py @@ -0,0 +1,193 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class RegulatoryComplianceAssessmentsOperations(object): + """RegulatoryComplianceAssessmentsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: API version for the operation. Constant value: "2019-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-01-01-preview" + + self.config = config + + def list( + self, resource_group_name, regulatory_compliance_standard_name, regulatory_compliance_control_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Details and state of assessments mapped to selected regulatory + compliance control. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param regulatory_compliance_standard_name: Name of the regulatory + compliance standard object + :type regulatory_compliance_standard_name: str + :param regulatory_compliance_control_name: Name of the regulatory + compliance control object + :type regulatory_compliance_control_name: str + :param filter: OData filter. Optional. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RegulatoryComplianceAssessment + :rtype: + ~azure.mgmt.security.models.RegulatoryComplianceAssessmentPaged[~azure.mgmt.security.models.RegulatoryComplianceAssessment] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'regulatoryComplianceStandardName': self._serialize.url("regulatory_compliance_standard_name", regulatory_compliance_standard_name, 'str'), + 'regulatoryComplianceControlName': self._serialize.url("regulatory_compliance_control_name", regulatory_compliance_control_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.RegulatoryComplianceAssessmentPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RegulatoryComplianceAssessmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments'} + + def get( + self, resource_group_name, regulatory_compliance_standard_name, regulatory_compliance_control_name, regulatory_compliance_assessment_name, custom_headers=None, raw=False, **operation_config): + """Supported regulatory compliance details and state for selected + assessment. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param regulatory_compliance_standard_name: Name of the regulatory + compliance standard object + :type regulatory_compliance_standard_name: str + :param regulatory_compliance_control_name: Name of the regulatory + compliance control object + :type regulatory_compliance_control_name: str + :param regulatory_compliance_assessment_name: Name of the regulatory + compliance assessment object + :type regulatory_compliance_assessment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RegulatoryComplianceAssessment or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.security.models.RegulatoryComplianceAssessment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'regulatoryComplianceStandardName': self._serialize.url("regulatory_compliance_standard_name", regulatory_compliance_standard_name, 'str'), + 'regulatoryComplianceControlName': self._serialize.url("regulatory_compliance_control_name", regulatory_compliance_control_name, 'str'), + 'regulatoryComplianceAssessmentName': self._serialize.url("regulatory_compliance_assessment_name", regulatory_compliance_assessment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RegulatoryComplianceAssessment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}'} diff --git a/azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_controls_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_controls_operations.py new file mode 100644 index 000000000000..9b5db20ec2eb --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_controls_operations.py @@ -0,0 +1,183 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class RegulatoryComplianceControlsOperations(object): + """RegulatoryComplianceControlsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: API version for the operation. Constant value: "2019-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-01-01-preview" + + self.config = config + + def list( + self, resource_group_name, regulatory_compliance_standard_name, filter=None, custom_headers=None, raw=False, **operation_config): + """All supported regulatory compliance controls details and state for + selected standard. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param regulatory_compliance_standard_name: Name of the regulatory + compliance standard object + :type regulatory_compliance_standard_name: str + :param filter: OData filter. Optional. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RegulatoryComplianceControl + :rtype: + ~azure.mgmt.security.models.RegulatoryComplianceControlPaged[~azure.mgmt.security.models.RegulatoryComplianceControl] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'regulatoryComplianceStandardName': self._serialize.url("regulatory_compliance_standard_name", regulatory_compliance_standard_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.RegulatoryComplianceControlPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RegulatoryComplianceControlPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls'} + + def get( + self, resource_group_name, regulatory_compliance_standard_name, regulatory_compliance_control_name, custom_headers=None, raw=False, **operation_config): + """Selected regulatory compliance control details and state. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param regulatory_compliance_standard_name: Name of the regulatory + compliance standard object + :type regulatory_compliance_standard_name: str + :param regulatory_compliance_control_name: Name of the regulatory + compliance control object + :type regulatory_compliance_control_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RegulatoryComplianceControl or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.RegulatoryComplianceControl or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'regulatoryComplianceStandardName': self._serialize.url("regulatory_compliance_standard_name", regulatory_compliance_standard_name, 'str'), + 'regulatoryComplianceControlName': self._serialize.url("regulatory_compliance_control_name", regulatory_compliance_control_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RegulatoryComplianceControl', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}'} diff --git a/azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_standards_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_standards_operations.py new file mode 100644 index 000000000000..43a9ce7a73ce --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/operations/regulatory_compliance_standards_operations.py @@ -0,0 +1,174 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class RegulatoryComplianceStandardsOperations(object): + """RegulatoryComplianceStandardsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: API version for the operation. Constant value: "2019-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-01-01-preview" + + self.config = config + + def list( + self, resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Supported regulatory compliance standards details and state. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param filter: OData filter. Optional. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RegulatoryComplianceStandard + :rtype: + ~azure.mgmt.security.models.RegulatoryComplianceStandardPaged[~azure.mgmt.security.models.RegulatoryComplianceStandard] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.RegulatoryComplianceStandardPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RegulatoryComplianceStandardPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/regulatoryComplianceStandards'} + + def get( + self, resource_group_name, regulatory_compliance_standard_name, custom_headers=None, raw=False, **operation_config): + """Supported regulatory compliance details state for selected standard. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param regulatory_compliance_standard_name: Name of the regulatory + compliance standard object + :type regulatory_compliance_standard_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RegulatoryComplianceStandard or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.RegulatoryComplianceStandard or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'regulatoryComplianceStandardName': self._serialize.url("regulatory_compliance_standard_name", regulatory_compliance_standard_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RegulatoryComplianceStandard', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}'} diff --git a/azure-mgmt-security/azure/mgmt/security/security_center.py b/azure-mgmt-security/azure/mgmt/security/security_center.py index 4a70b5762f4f..0edb524bceb5 100644 --- a/azure-mgmt-security/azure/mgmt/security/security_center.py +++ b/azure-mgmt-security/azure/mgmt/security/security_center.py @@ -13,6 +13,9 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION +from .operations.regulatory_compliance_standards_operations import RegulatoryComplianceStandardsOperations +from .operations.regulatory_compliance_controls_operations import RegulatoryComplianceControlsOperations +from .operations.regulatory_compliance_assessments_operations import RegulatoryComplianceAssessmentsOperations from .operations.pricings_operations import PricingsOperations from .operations.security_contacts_operations import SecurityContactsOperations from .operations.workspace_settings_operations import WorkspaceSettingsOperations @@ -30,6 +33,7 @@ from .operations.external_security_solutions_operations import ExternalSecuritySolutionsOperations from .operations.topology_operations import TopologyOperations from .operations.allowed_connections_operations import AllowedConnectionsOperations +from .operations.adaptive_network_hardenings_operations import AdaptiveNetworkHardeningsOperations from . import models @@ -77,6 +81,12 @@ class SecurityCenter(SDKClient): :ivar config: Configuration for client. :vartype config: SecurityCenterConfiguration + :ivar regulatory_compliance_standards: RegulatoryComplianceStandards operations + :vartype regulatory_compliance_standards: azure.mgmt.security.operations.RegulatoryComplianceStandardsOperations + :ivar regulatory_compliance_controls: RegulatoryComplianceControls operations + :vartype regulatory_compliance_controls: azure.mgmt.security.operations.RegulatoryComplianceControlsOperations + :ivar regulatory_compliance_assessments: RegulatoryComplianceAssessments operations + :vartype regulatory_compliance_assessments: azure.mgmt.security.operations.RegulatoryComplianceAssessmentsOperations :ivar pricings: Pricings operations :vartype pricings: azure.mgmt.security.operations.PricingsOperations :ivar security_contacts: SecurityContacts operations @@ -111,6 +121,8 @@ class SecurityCenter(SDKClient): :vartype topology: azure.mgmt.security.operations.TopologyOperations :ivar allowed_connections: AllowedConnections operations :vartype allowed_connections: azure.mgmt.security.operations.AllowedConnectionsOperations + :ivar adaptive_network_hardenings: AdaptiveNetworkHardenings operations + :vartype adaptive_network_hardenings: azure.mgmt.security.operations.AdaptiveNetworkHardeningsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -133,6 +145,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.regulatory_compliance_standards = RegulatoryComplianceStandardsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.regulatory_compliance_controls = RegulatoryComplianceControlsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.regulatory_compliance_assessments = RegulatoryComplianceAssessmentsOperations( + self._client, self.config, self._serialize, self._deserialize) self.pricings = PricingsOperations( self._client, self.config, self._serialize, self._deserialize) self.security_contacts = SecurityContactsOperations( @@ -167,3 +185,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.allowed_connections = AllowedConnectionsOperations( self._client, self.config, self._serialize, self._deserialize) + self.adaptive_network_hardenings = AdaptiveNetworkHardeningsOperations( + self._client, self.config, self._serialize, self._deserialize) From 69366c4a2ee330b9cee7f90a4dc0c3e0a2e9c0ce Mon Sep 17 00:00:00 2001 From: azuresdkci Date: Mon, 25 Mar 2019 16:48:22 +0000 Subject: [PATCH 10/11] Packaging update of azure-mgmt-security --- azure-mgmt-security/README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-mgmt-security/README.rst b/azure-mgmt-security/README.rst index d61634454d3e..1c169fa017e4 100644 --- a/azure-mgmt-security/README.rst +++ b/azure-mgmt-security/README.rst @@ -28,3 +28,6 @@ Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the `Issues `__ section of the project. + + +.. image:: https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-security%2FREADME.png From 05911fbb2c7fa89a4df04ca772c7272a7fd2a6ec Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 25 Mar 2019 17:02:51 +0000 Subject: [PATCH 11/11] Generated from 0efd3e575484e7c34ea173274d8699bfdcd01608 Adding Adaptive Network Hardenings to Security readme.md --- .../azure/mgmt/security/models/__init__.py | 25 ++ .../models/allowlist_custom_alert_rule.py | 60 ++++ .../models/allowlist_custom_alert_rule_py3.py | 60 ++++ .../mgmt/security/models/custom_alert_rule.py | 52 ++++ .../security/models/custom_alert_rule_py3.py | 52 ++++ .../models/denylist_custom_alert_rule.py | 60 ++++ .../models/denylist_custom_alert_rule_py3.py | 60 ++++ .../security/models/device_security_group.py | 62 ++++ .../models/device_security_group_paged.py | 27 ++ .../models/device_security_group_py3.py | 62 ++++ .../security/models/list_custom_alert_rule.py | 54 ++++ .../models/list_custom_alert_rule_py3.py | 54 ++++ .../security/models/security_center_enums.py | 6 + .../models/threshold_custom_alert_rule.py | 59 ++++ .../models/threshold_custom_alert_rule_py3.py | 59 ++++ .../models/time_window_custom_alert_rule.py | 68 ++++ .../time_window_custom_alert_rule_py3.py | 68 ++++ .../mgmt/security/operations/__init__.py | 2 + .../device_security_groups_operations.py | 292 ++++++++++++++++++ .../azure/mgmt/security/security_center.py | 5 + 20 files changed, 1187 insertions(+) create mode 100644 azure-mgmt-security/azure/mgmt/security/models/allowlist_custom_alert_rule.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/allowlist_custom_alert_rule_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/custom_alert_rule.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/custom_alert_rule_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/denylist_custom_alert_rule.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/denylist_custom_alert_rule_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/device_security_group.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/device_security_group_paged.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/device_security_group_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/list_custom_alert_rule.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/list_custom_alert_rule_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/threshold_custom_alert_rule.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/threshold_custom_alert_rule_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/time_window_custom_alert_rule.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/time_window_custom_alert_rule_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/operations/device_security_groups_operations.py diff --git a/azure-mgmt-security/azure/mgmt/security/models/__init__.py b/azure-mgmt-security/azure/mgmt/security/models/__init__.py index eddf3521a904..4b7ad61755a8 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/models/__init__.py @@ -23,6 +23,13 @@ from .compliance_segment_py3 import ComplianceSegment from .compliance_py3 import Compliance from .advanced_threat_protection_setting_py3 import AdvancedThreatProtectionSetting + from .threshold_custom_alert_rule_py3 import ThresholdCustomAlertRule + from .time_window_custom_alert_rule_py3 import TimeWindowCustomAlertRule + from .allowlist_custom_alert_rule_py3 import AllowlistCustomAlertRule + from .denylist_custom_alert_rule_py3 import DenylistCustomAlertRule + from .device_security_group_py3 import DeviceSecurityGroup + from .custom_alert_rule_py3 import CustomAlertRule + from .list_custom_alert_rule_py3 import ListCustomAlertRule from .setting_py3 import Setting from .data_export_setting_py3 import DataExportSetting from .setting_resource_py3 import SettingResource @@ -85,6 +92,13 @@ from .compliance_segment import ComplianceSegment from .compliance import Compliance from .advanced_threat_protection_setting import AdvancedThreatProtectionSetting + from .threshold_custom_alert_rule import ThresholdCustomAlertRule + from .time_window_custom_alert_rule import TimeWindowCustomAlertRule + from .allowlist_custom_alert_rule import AllowlistCustomAlertRule + from .denylist_custom_alert_rule import DenylistCustomAlertRule + from .device_security_group import DeviceSecurityGroup + from .custom_alert_rule import CustomAlertRule + from .list_custom_alert_rule import ListCustomAlertRule from .setting import Setting from .data_export_setting import DataExportSetting from .setting_resource import SettingResource @@ -140,6 +154,7 @@ from .workspace_setting_paged import WorkspaceSettingPaged from .auto_provisioning_setting_paged import AutoProvisioningSettingPaged from .compliance_paged import CompliancePaged +from .device_security_group_paged import DeviceSecurityGroupPaged from .setting_paged import SettingPaged from .information_protection_policy_paged import InformationProtectionPolicyPaged from .operation_paged import OperationPaged @@ -158,6 +173,7 @@ AlertNotifications, AlertsToAdmins, AutoProvision, + ValueType, SettingKind, ReportedSeverity, SecurityFamily, @@ -185,6 +201,13 @@ 'ComplianceSegment', 'Compliance', 'AdvancedThreatProtectionSetting', + 'ThresholdCustomAlertRule', + 'TimeWindowCustomAlertRule', + 'AllowlistCustomAlertRule', + 'DenylistCustomAlertRule', + 'DeviceSecurityGroup', + 'CustomAlertRule', + 'ListCustomAlertRule', 'Setting', 'DataExportSetting', 'SettingResource', @@ -240,6 +263,7 @@ 'WorkspaceSettingPaged', 'AutoProvisioningSettingPaged', 'CompliancePaged', + 'DeviceSecurityGroupPaged', 'SettingPaged', 'InformationProtectionPolicyPaged', 'OperationPaged', @@ -257,6 +281,7 @@ 'AlertNotifications', 'AlertsToAdmins', 'AutoProvision', + 'ValueType', 'SettingKind', 'ReportedSeverity', 'SecurityFamily', diff --git a/azure-mgmt-security/azure/mgmt/security/models/allowlist_custom_alert_rule.py b/azure-mgmt-security/azure/mgmt/security/models/allowlist_custom_alert_rule.py new file mode 100644 index 000000000000..58275b4e2fbb --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/allowlist_custom_alert_rule.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .list_custom_alert_rule import ListCustomAlertRule + + +class AllowlistCustomAlertRule(ListCustomAlertRule): + """A custom alert rule that checks if a value (depends on the custom alert + type) is allowed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + :ivar value_type: The value type of the items in the list. Possible values + include: 'IpCidr', 'String' + :vartype value_type: str or ~azure.mgmt.security.models.ValueType + :param allowlist_values: Required. The values to allow. The format of the + values depends on the rule type. + :type allowlist_values: list[str] + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + 'value_type': {'readonly': True}, + 'allowlist_values': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'value_type': {'key': 'valueType', 'type': 'str'}, + 'allowlist_values': {'key': 'allowlistValues', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(AllowlistCustomAlertRule, self).__init__(**kwargs) + self.allowlist_values = kwargs.get('allowlist_values', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/allowlist_custom_alert_rule_py3.py b/azure-mgmt-security/azure/mgmt/security/models/allowlist_custom_alert_rule_py3.py new file mode 100644 index 000000000000..7f8772c3dbbd --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/allowlist_custom_alert_rule_py3.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .list_custom_alert_rule_py3 import ListCustomAlertRule + + +class AllowlistCustomAlertRule(ListCustomAlertRule): + """A custom alert rule that checks if a value (depends on the custom alert + type) is allowed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + :ivar value_type: The value type of the items in the list. Possible values + include: 'IpCidr', 'String' + :vartype value_type: str or ~azure.mgmt.security.models.ValueType + :param allowlist_values: Required. The values to allow. The format of the + values depends on the rule type. + :type allowlist_values: list[str] + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + 'value_type': {'readonly': True}, + 'allowlist_values': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'value_type': {'key': 'valueType', 'type': 'str'}, + 'allowlist_values': {'key': 'allowlistValues', 'type': '[str]'}, + } + + def __init__(self, *, is_enabled: bool, rule_type: str, allowlist_values, **kwargs) -> None: + super(AllowlistCustomAlertRule, self).__init__(is_enabled=is_enabled, rule_type=rule_type, **kwargs) + self.allowlist_values = allowlist_values diff --git a/azure-mgmt-security/azure/mgmt/security/models/custom_alert_rule.py b/azure-mgmt-security/azure/mgmt/security/models/custom_alert_rule.py new file mode 100644 index 000000000000..7b8bbed4659f --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/custom_alert_rule.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CustomAlertRule(Model): + """A custom alert rule. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CustomAlertRule, self).__init__(**kwargs) + self.display_name = None + self.description = None + self.is_enabled = kwargs.get('is_enabled', None) + self.rule_type = kwargs.get('rule_type', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/custom_alert_rule_py3.py b/azure-mgmt-security/azure/mgmt/security/models/custom_alert_rule_py3.py new file mode 100644 index 000000000000..8ecf4bf163cb --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/custom_alert_rule_py3.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CustomAlertRule(Model): + """A custom alert rule. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + } + + def __init__(self, *, is_enabled: bool, rule_type: str, **kwargs) -> None: + super(CustomAlertRule, self).__init__(**kwargs) + self.display_name = None + self.description = None + self.is_enabled = is_enabled + self.rule_type = rule_type diff --git a/azure-mgmt-security/azure/mgmt/security/models/denylist_custom_alert_rule.py b/azure-mgmt-security/azure/mgmt/security/models/denylist_custom_alert_rule.py new file mode 100644 index 000000000000..976650ae94b9 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/denylist_custom_alert_rule.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .list_custom_alert_rule import ListCustomAlertRule + + +class DenylistCustomAlertRule(ListCustomAlertRule): + """A custom alert rule that checks if a value (depends on the custom alert + type) is denied. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + :ivar value_type: The value type of the items in the list. Possible values + include: 'IpCidr', 'String' + :vartype value_type: str or ~azure.mgmt.security.models.ValueType + :param denylist_values: Required. The values to deny. The format of the + values depends on the rule type. + :type denylist_values: list[str] + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + 'value_type': {'readonly': True}, + 'denylist_values': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'value_type': {'key': 'valueType', 'type': 'str'}, + 'denylist_values': {'key': 'denylistValues', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(DenylistCustomAlertRule, self).__init__(**kwargs) + self.denylist_values = kwargs.get('denylist_values', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/denylist_custom_alert_rule_py3.py b/azure-mgmt-security/azure/mgmt/security/models/denylist_custom_alert_rule_py3.py new file mode 100644 index 000000000000..9813e72eea68 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/denylist_custom_alert_rule_py3.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .list_custom_alert_rule_py3 import ListCustomAlertRule + + +class DenylistCustomAlertRule(ListCustomAlertRule): + """A custom alert rule that checks if a value (depends on the custom alert + type) is denied. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + :ivar value_type: The value type of the items in the list. Possible values + include: 'IpCidr', 'String' + :vartype value_type: str or ~azure.mgmt.security.models.ValueType + :param denylist_values: Required. The values to deny. The format of the + values depends on the rule type. + :type denylist_values: list[str] + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + 'value_type': {'readonly': True}, + 'denylist_values': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'value_type': {'key': 'valueType', 'type': 'str'}, + 'denylist_values': {'key': 'denylistValues', 'type': '[str]'}, + } + + def __init__(self, *, is_enabled: bool, rule_type: str, denylist_values, **kwargs) -> None: + super(DenylistCustomAlertRule, self).__init__(is_enabled=is_enabled, rule_type=rule_type, **kwargs) + self.denylist_values = denylist_values diff --git a/azure-mgmt-security/azure/mgmt/security/models/device_security_group.py b/azure-mgmt-security/azure/mgmt/security/models/device_security_group.py new file mode 100644 index 000000000000..a213758a98c6 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/device_security_group.py @@ -0,0 +1,62 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class DeviceSecurityGroup(Resource): + """The device security group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param threshold_rules: A list of threshold custom alert rules. + :type threshold_rules: + list[~azure.mgmt.security.models.ThresholdCustomAlertRule] + :param time_window_rules: A list of time window custom alert rules. + :type time_window_rules: + list[~azure.mgmt.security.models.TimeWindowCustomAlertRule] + :param allowlist_rules: A list of allow-list custom alert rules. + :type allowlist_rules: + list[~azure.mgmt.security.models.AllowlistCustomAlertRule] + :param denylist_rules: A list of deny-list custom alert rules. + :type denylist_rules: + list[~azure.mgmt.security.models.DenylistCustomAlertRule] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'threshold_rules': {'key': 'properties.thresholdRules', 'type': '[ThresholdCustomAlertRule]'}, + 'time_window_rules': {'key': 'properties.timeWindowRules', 'type': '[TimeWindowCustomAlertRule]'}, + 'allowlist_rules': {'key': 'properties.allowlistRules', 'type': '[AllowlistCustomAlertRule]'}, + 'denylist_rules': {'key': 'properties.denylistRules', 'type': '[DenylistCustomAlertRule]'}, + } + + def __init__(self, **kwargs): + super(DeviceSecurityGroup, self).__init__(**kwargs) + self.threshold_rules = kwargs.get('threshold_rules', None) + self.time_window_rules = kwargs.get('time_window_rules', None) + self.allowlist_rules = kwargs.get('allowlist_rules', None) + self.denylist_rules = kwargs.get('denylist_rules', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/device_security_group_paged.py b/azure-mgmt-security/azure/mgmt/security/models/device_security_group_paged.py new file mode 100644 index 000000000000..cf7fcb32eed7 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/device_security_group_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class DeviceSecurityGroupPaged(Paged): + """ + A paging container for iterating over a list of :class:`DeviceSecurityGroup ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DeviceSecurityGroup]'} + } + + def __init__(self, *args, **kwargs): + + super(DeviceSecurityGroupPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/device_security_group_py3.py b/azure-mgmt-security/azure/mgmt/security/models/device_security_group_py3.py new file mode 100644 index 000000000000..9e2a2015d800 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/device_security_group_py3.py @@ -0,0 +1,62 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .resource_py3 import Resource + + +class DeviceSecurityGroup(Resource): + """The device security group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param threshold_rules: A list of threshold custom alert rules. + :type threshold_rules: + list[~azure.mgmt.security.models.ThresholdCustomAlertRule] + :param time_window_rules: A list of time window custom alert rules. + :type time_window_rules: + list[~azure.mgmt.security.models.TimeWindowCustomAlertRule] + :param allowlist_rules: A list of allow-list custom alert rules. + :type allowlist_rules: + list[~azure.mgmt.security.models.AllowlistCustomAlertRule] + :param denylist_rules: A list of deny-list custom alert rules. + :type denylist_rules: + list[~azure.mgmt.security.models.DenylistCustomAlertRule] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'threshold_rules': {'key': 'properties.thresholdRules', 'type': '[ThresholdCustomAlertRule]'}, + 'time_window_rules': {'key': 'properties.timeWindowRules', 'type': '[TimeWindowCustomAlertRule]'}, + 'allowlist_rules': {'key': 'properties.allowlistRules', 'type': '[AllowlistCustomAlertRule]'}, + 'denylist_rules': {'key': 'properties.denylistRules', 'type': '[DenylistCustomAlertRule]'}, + } + + def __init__(self, *, threshold_rules=None, time_window_rules=None, allowlist_rules=None, denylist_rules=None, **kwargs) -> None: + super(DeviceSecurityGroup, self).__init__(**kwargs) + self.threshold_rules = threshold_rules + self.time_window_rules = time_window_rules + self.allowlist_rules = allowlist_rules + self.denylist_rules = denylist_rules diff --git a/azure-mgmt-security/azure/mgmt/security/models/list_custom_alert_rule.py b/azure-mgmt-security/azure/mgmt/security/models/list_custom_alert_rule.py new file mode 100644 index 000000000000..83ac0df72267 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/list_custom_alert_rule.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .custom_alert_rule import CustomAlertRule + + +class ListCustomAlertRule(CustomAlertRule): + """A List custom alert rule. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + :ivar value_type: The value type of the items in the list. Possible values + include: 'IpCidr', 'String' + :vartype value_type: str or ~azure.mgmt.security.models.ValueType + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + 'value_type': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'value_type': {'key': 'valueType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ListCustomAlertRule, self).__init__(**kwargs) + self.value_type = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/list_custom_alert_rule_py3.py b/azure-mgmt-security/azure/mgmt/security/models/list_custom_alert_rule_py3.py new file mode 100644 index 000000000000..ae713623de5f --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/list_custom_alert_rule_py3.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .custom_alert_rule_py3 import CustomAlertRule + + +class ListCustomAlertRule(CustomAlertRule): + """A List custom alert rule. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + :ivar value_type: The value type of the items in the list. Possible values + include: 'IpCidr', 'String' + :vartype value_type: str or ~azure.mgmt.security.models.ValueType + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + 'value_type': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'value_type': {'key': 'valueType', 'type': 'str'}, + } + + def __init__(self, *, is_enabled: bool, rule_type: str, **kwargs) -> None: + super(ListCustomAlertRule, self).__init__(is_enabled=is_enabled, rule_type=rule_type, **kwargs) + self.value_type = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py index 34e12e448ae1..d3ada17e2460 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py +++ b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py @@ -44,6 +44,12 @@ class AutoProvision(str, Enum): off = "Off" #: Do not install security agent on the VMs automatically +class ValueType(str, Enum): + + ip_cidr = "IpCidr" #: An IP range in CIDR format (e.g. '192.168.0.1/8'). + string = "String" #: Any string value. + + class SettingKind(str, Enum): data_export_setting = "DataExportSetting" diff --git a/azure-mgmt-security/azure/mgmt/security/models/threshold_custom_alert_rule.py b/azure-mgmt-security/azure/mgmt/security/models/threshold_custom_alert_rule.py new file mode 100644 index 000000000000..4e6306190e2b --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/threshold_custom_alert_rule.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .custom_alert_rule import CustomAlertRule + + +class ThresholdCustomAlertRule(CustomAlertRule): + """A custom alert rule that checks if a value (depends on the custom alert + type) is within the given range. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + :param min_threshold: Required. The minimum threshold. + :type min_threshold: int + :param max_threshold: Required. The maximum threshold. + :type max_threshold: int + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + 'min_threshold': {'required': True}, + 'max_threshold': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'min_threshold': {'key': 'minThreshold', 'type': 'int'}, + 'max_threshold': {'key': 'maxThreshold', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ThresholdCustomAlertRule, self).__init__(**kwargs) + self.min_threshold = kwargs.get('min_threshold', None) + self.max_threshold = kwargs.get('max_threshold', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/threshold_custom_alert_rule_py3.py b/azure-mgmt-security/azure/mgmt/security/models/threshold_custom_alert_rule_py3.py new file mode 100644 index 000000000000..63c5567caceb --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/threshold_custom_alert_rule_py3.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .custom_alert_rule_py3 import CustomAlertRule + + +class ThresholdCustomAlertRule(CustomAlertRule): + """A custom alert rule that checks if a value (depends on the custom alert + type) is within the given range. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + :param min_threshold: Required. The minimum threshold. + :type min_threshold: int + :param max_threshold: Required. The maximum threshold. + :type max_threshold: int + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + 'min_threshold': {'required': True}, + 'max_threshold': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'min_threshold': {'key': 'minThreshold', 'type': 'int'}, + 'max_threshold': {'key': 'maxThreshold', 'type': 'int'}, + } + + def __init__(self, *, is_enabled: bool, rule_type: str, min_threshold: int, max_threshold: int, **kwargs) -> None: + super(ThresholdCustomAlertRule, self).__init__(is_enabled=is_enabled, rule_type=rule_type, **kwargs) + self.min_threshold = min_threshold + self.max_threshold = max_threshold diff --git a/azure-mgmt-security/azure/mgmt/security/models/time_window_custom_alert_rule.py b/azure-mgmt-security/azure/mgmt/security/models/time_window_custom_alert_rule.py new file mode 100644 index 000000000000..224d5a3dc0ea --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/time_window_custom_alert_rule.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TimeWindowCustomAlertRule(Model): + """A custom alert rule that checks if the number of activities (depends on the + custom alert type) in a time window is within the given range. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + :param min_threshold: Required. The minimum threshold. + :type min_threshold: int + :param max_threshold: Required. The maximum threshold. + :type max_threshold: int + :param time_window_size: Required. The time window size in iso8601 format. + :type time_window_size: timedelta + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + 'min_threshold': {'required': True}, + 'max_threshold': {'required': True}, + 'time_window_size': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'min_threshold': {'key': 'minThreshold', 'type': 'int'}, + 'max_threshold': {'key': 'maxThreshold', 'type': 'int'}, + 'time_window_size': {'key': 'timeWindowSize', 'type': 'duration'}, + } + + def __init__(self, **kwargs): + super(TimeWindowCustomAlertRule, self).__init__(**kwargs) + self.display_name = None + self.description = None + self.is_enabled = kwargs.get('is_enabled', None) + self.rule_type = kwargs.get('rule_type', None) + self.min_threshold = kwargs.get('min_threshold', None) + self.max_threshold = kwargs.get('max_threshold', None) + self.time_window_size = kwargs.get('time_window_size', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/time_window_custom_alert_rule_py3.py b/azure-mgmt-security/azure/mgmt/security/models/time_window_custom_alert_rule_py3.py new file mode 100644 index 000000000000..0a2962dddb94 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/time_window_custom_alert_rule_py3.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TimeWindowCustomAlertRule(Model): + """A custom alert rule that checks if the number of activities (depends on the + custom alert type) in a time window is within the given range. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar display_name: The display name of the custom alert. + :vartype display_name: str + :ivar description: The description of the custom alert. + :vartype description: str + :param is_enabled: Required. Whether the custom alert is enabled. + :type is_enabled: bool + :param rule_type: Required. The type of the custom alert rule. + :type rule_type: str + :param min_threshold: Required. The minimum threshold. + :type min_threshold: int + :param max_threshold: Required. The maximum threshold. + :type max_threshold: int + :param time_window_size: Required. The time window size in iso8601 format. + :type time_window_size: timedelta + """ + + _validation = { + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'is_enabled': {'required': True}, + 'rule_type': {'required': True}, + 'min_threshold': {'required': True}, + 'max_threshold': {'required': True}, + 'time_window_size': {'required': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'min_threshold': {'key': 'minThreshold', 'type': 'int'}, + 'max_threshold': {'key': 'maxThreshold', 'type': 'int'}, + 'time_window_size': {'key': 'timeWindowSize', 'type': 'duration'}, + } + + def __init__(self, *, is_enabled: bool, rule_type: str, min_threshold: int, max_threshold: int, time_window_size, **kwargs) -> None: + super(TimeWindowCustomAlertRule, self).__init__(**kwargs) + self.display_name = None + self.description = None + self.is_enabled = is_enabled + self.rule_type = rule_type + self.min_threshold = min_threshold + self.max_threshold = max_threshold + self.time_window_size = time_window_size diff --git a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py index 5f3a089a1888..19233b1cafa1 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py @@ -18,6 +18,7 @@ from .auto_provisioning_settings_operations import AutoProvisioningSettingsOperations from .compliances_operations import CompliancesOperations from .advanced_threat_protection_operations import AdvancedThreatProtectionOperations +from .device_security_groups_operations import DeviceSecurityGroupsOperations from .settings_operations import SettingsOperations from .information_protection_policies_operations import InformationProtectionPoliciesOperations from .operations import Operations @@ -41,6 +42,7 @@ 'AutoProvisioningSettingsOperations', 'CompliancesOperations', 'AdvancedThreatProtectionOperations', + 'DeviceSecurityGroupsOperations', 'SettingsOperations', 'InformationProtectionPoliciesOperations', 'Operations', diff --git a/azure-mgmt-security/azure/mgmt/security/operations/device_security_groups_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/device_security_groups_operations.py new file mode 100644 index 000000000000..a55f1ed2f3c9 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/operations/device_security_groups_operations.py @@ -0,0 +1,292 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class DeviceSecurityGroupsOperations(object): + """DeviceSecurityGroupsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: API version for the operation. Constant value: "2017-08-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-08-01-preview" + + self.config = config + + def list( + self, resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the list of device security groups for the specified IoT hub + resource. + + :param resource_id: The identifier of the resource. + :type resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeviceSecurityGroup + :rtype: + ~azure.mgmt.security.models.DeviceSecurityGroupPaged[~azure.mgmt.security.models.DeviceSecurityGroup] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.DeviceSecurityGroupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.DeviceSecurityGroupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups'} + + def get( + self, resource_id, device_security_group_name, custom_headers=None, raw=False, **operation_config): + """Gets the device security group for the specified IoT hub resource. + + :param resource_id: The identifier of the resource. + :type resource_id: str + :param device_security_group_name: The name of the security group. + Please notice that the name is case insensitive. + :type device_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeviceSecurityGroup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.DeviceSecurityGroup or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str'), + 'deviceSecurityGroupName': self._serialize.url("device_security_group_name", device_security_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DeviceSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}'} + + def create_or_update( + self, resource_id, device_security_group_name, device_security_group, custom_headers=None, raw=False, **operation_config): + """Creates or updates the device security group on a specified IoT hub + resource. + + :param resource_id: The identifier of the resource. + :type resource_id: str + :param device_security_group_name: The name of the security group. + Please notice that the name is case insensitive. + :type device_security_group_name: str + :param device_security_group: Security group object. + :type device_security_group: + ~azure.mgmt.security.models.DeviceSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeviceSecurityGroup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.DeviceSecurityGroup or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str'), + 'deviceSecurityGroupName': self._serialize.url("device_security_group_name", device_security_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(device_security_group, 'DeviceSecurityGroup') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DeviceSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('DeviceSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}'} + + def delete( + self, resource_id, device_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the security group. + + :param resource_id: The identifier of the resource. + :type resource_id: str + :param device_security_group_name: The name of the security group. + Please notice that the name is case insensitive. + :type device_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str'), + 'deviceSecurityGroupName': self._serialize.url("device_security_group_name", device_security_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}'} diff --git a/azure-mgmt-security/azure/mgmt/security/security_center.py b/azure-mgmt-security/azure/mgmt/security/security_center.py index 0edb524bceb5..e285148cca73 100644 --- a/azure-mgmt-security/azure/mgmt/security/security_center.py +++ b/azure-mgmt-security/azure/mgmt/security/security_center.py @@ -22,6 +22,7 @@ from .operations.auto_provisioning_settings_operations import AutoProvisioningSettingsOperations from .operations.compliances_operations import CompliancesOperations from .operations.advanced_threat_protection_operations import AdvancedThreatProtectionOperations +from .operations.device_security_groups_operations import DeviceSecurityGroupsOperations from .operations.settings_operations import SettingsOperations from .operations.information_protection_policies_operations import InformationProtectionPoliciesOperations from .operations.operations import Operations @@ -99,6 +100,8 @@ class SecurityCenter(SDKClient): :vartype compliances: azure.mgmt.security.operations.CompliancesOperations :ivar advanced_threat_protection: AdvancedThreatProtection operations :vartype advanced_threat_protection: azure.mgmt.security.operations.AdvancedThreatProtectionOperations + :ivar device_security_groups: DeviceSecurityGroups operations + :vartype device_security_groups: azure.mgmt.security.operations.DeviceSecurityGroupsOperations :ivar settings: Settings operations :vartype settings: azure.mgmt.security.operations.SettingsOperations :ivar information_protection_policies: InformationProtectionPolicies operations @@ -163,6 +166,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.advanced_threat_protection = AdvancedThreatProtectionOperations( self._client, self.config, self._serialize, self._deserialize) + self.device_security_groups = DeviceSecurityGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) self.settings = SettingsOperations( self._client, self.config, self._serialize, self._deserialize) self.information_protection_policies = InformationProtectionPoliciesOperations(