diff --git a/azure-mgmt-security/azure/mgmt/security/models/__init__.py b/azure-mgmt-security/azure/mgmt/security/models/__init__.py index 059deadbd310..47bdff08e273 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/models/__init__.py @@ -60,6 +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 .connected_resource_py3 import ConnectedResource + from .connectable_resource_py3 import ConnectableResource + from .allowed_connections_resource_py3 import AllowedConnectionsResource except (SyntaxError, ImportError): from .resource import Resource from .kind import Kind @@ -111,6 +114,9 @@ from .external_security_solution_kind1 import ExternalSecuritySolutionKind1 from .external_security_solution_properties import ExternalSecuritySolutionProperties from .aad_connectivity_state1 import AadConnectivityState1 + 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 @@ -126,6 +132,7 @@ from .jit_network_access_policy_paged import JitNetworkAccessPolicyPaged from .external_security_solution_paged import ExternalSecuritySolutionPaged from .topology_resource_paged import TopologyResourcePaged +from .allowed_connections_resource_paged import AllowedConnectionsResourcePaged from .security_center_enums import ( AlertNotifications, AlertsToAdmins, @@ -138,6 +145,7 @@ StatusReason, AadConnectivityState, ExternalSecuritySolutionKind, + ConnectionType, ) __all__ = [ @@ -191,6 +199,9 @@ 'ExternalSecuritySolutionKind1', 'ExternalSecuritySolutionProperties', 'AadConnectivityState1', + 'ConnectedResource', + 'ConnectableResource', + 'AllowedConnectionsResource', 'PricingPaged', 'SecurityContactPaged', 'WorkspaceSettingPaged', @@ -206,6 +217,7 @@ 'JitNetworkAccessPolicyPaged', 'ExternalSecuritySolutionPaged', 'TopologyResourcePaged', + 'AllowedConnectionsResourcePaged', 'AlertNotifications', 'AlertsToAdmins', 'PricingTier', @@ -217,4 +229,5 @@ 'StatusReason', 'AadConnectivityState', 'ExternalSecuritySolutionKind', + 'ConnectionType', ] diff --git a/azure-mgmt-security/azure/mgmt/security/models/allowed_connections_resource.py b/azure-mgmt-security/azure/mgmt/security/models/allowed_connections_resource.py new file mode 100644 index 000000000000..a33332d21a3a --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/allowed_connections_resource.py @@ -0,0 +1,63 @@ +# 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 AllowedConnectionsResource(Model): + """The resource whose properties describes the allowed traffic between Azure + resources. + + 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 location: Location where the resource is stored + :vartype location: str + :ivar calculated_date_time: The UTC time on which the allowed connections + resource was calculated + :vartype calculated_date_time: datetime + :ivar connectable_resources: List of connectable resources + :vartype connectable_resources: + list[~azure.mgmt.security.models.ConnectableResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'calculated_date_time': {'readonly': True}, + 'connectable_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'calculated_date_time': {'key': 'properties.calculatedDateTime', 'type': 'iso-8601'}, + 'connectable_resources': {'key': 'properties.connectableResources', 'type': '[ConnectableResource]'}, + } + + def __init__(self, **kwargs): + super(AllowedConnectionsResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.calculated_date_time = None + self.connectable_resources = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/allowed_connections_resource_paged.py b/azure-mgmt-security/azure/mgmt/security/models/allowed_connections_resource_paged.py new file mode 100644 index 000000000000..6a1696891e15 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/allowed_connections_resource_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 AllowedConnectionsResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`AllowedConnectionsResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AllowedConnectionsResource]'} + } + + def __init__(self, *args, **kwargs): + + super(AllowedConnectionsResourcePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/allowed_connections_resource_py3.py b/azure-mgmt-security/azure/mgmt/security/models/allowed_connections_resource_py3.py new file mode 100644 index 000000000000..c6cc09b53298 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/allowed_connections_resource_py3.py @@ -0,0 +1,63 @@ +# 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 AllowedConnectionsResource(Model): + """The resource whose properties describes the allowed traffic between Azure + resources. + + 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 location: Location where the resource is stored + :vartype location: str + :ivar calculated_date_time: The UTC time on which the allowed connections + resource was calculated + :vartype calculated_date_time: datetime + :ivar connectable_resources: List of connectable resources + :vartype connectable_resources: + list[~azure.mgmt.security.models.ConnectableResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'calculated_date_time': {'readonly': True}, + 'connectable_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'calculated_date_time': {'key': 'properties.calculatedDateTime', 'type': 'iso-8601'}, + 'connectable_resources': {'key': 'properties.connectableResources', 'type': '[ConnectableResource]'}, + } + + def __init__(self, **kwargs) -> None: + super(AllowedConnectionsResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.calculated_date_time = None + self.connectable_resources = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/connectable_resource.py b/azure-mgmt-security/azure/mgmt/security/models/connectable_resource.py new file mode 100644 index 000000000000..617931b620d2 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/connectable_resource.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 ConnectableResource(Model): + """Describes the allowed inbound and outbound traffic of an Azure resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The Azure resource id + :vartype id: str + :ivar inbound_connected_resources: The list of Azure resources that the + resource has inbound allowed connection from + :vartype inbound_connected_resources: + list[~azure.mgmt.security.models.ConnectedResource] + :ivar outbound_connected_resources: The list of Azure resources that the + resource has outbound allowed connection to + :vartype outbound_connected_resources: + list[~azure.mgmt.security.models.ConnectedResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'inbound_connected_resources': {'readonly': True}, + 'outbound_connected_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'inbound_connected_resources': {'key': 'inboundConnectedResources', 'type': '[ConnectedResource]'}, + 'outbound_connected_resources': {'key': 'outboundConnectedResources', 'type': '[ConnectedResource]'}, + } + + def __init__(self, **kwargs): + super(ConnectableResource, self).__init__(**kwargs) + self.id = None + self.inbound_connected_resources = None + self.outbound_connected_resources = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/connectable_resource_py3.py b/azure-mgmt-security/azure/mgmt/security/models/connectable_resource_py3.py new file mode 100644 index 000000000000..405942f2b228 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/connectable_resource_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 ConnectableResource(Model): + """Describes the allowed inbound and outbound traffic of an Azure resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The Azure resource id + :vartype id: str + :ivar inbound_connected_resources: The list of Azure resources that the + resource has inbound allowed connection from + :vartype inbound_connected_resources: + list[~azure.mgmt.security.models.ConnectedResource] + :ivar outbound_connected_resources: The list of Azure resources that the + resource has outbound allowed connection to + :vartype outbound_connected_resources: + list[~azure.mgmt.security.models.ConnectedResource] + """ + + _validation = { + 'id': {'readonly': True}, + 'inbound_connected_resources': {'readonly': True}, + 'outbound_connected_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'inbound_connected_resources': {'key': 'inboundConnectedResources', 'type': '[ConnectedResource]'}, + 'outbound_connected_resources': {'key': 'outboundConnectedResources', 'type': '[ConnectedResource]'}, + } + + def __init__(self, **kwargs) -> None: + super(ConnectableResource, self).__init__(**kwargs) + self.id = None + self.inbound_connected_resources = None + self.outbound_connected_resources = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/connected_resource.py b/azure-mgmt-security/azure/mgmt/security/models/connected_resource.py new file mode 100644 index 000000000000..cb4e417044cd --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/connected_resource.py @@ -0,0 +1,46 @@ +# 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 ConnectedResource(Model): + """Describes properties of a connected resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar connected_resource_id: The Azure resource id of the connected + resource + :vartype connected_resource_id: str + :ivar tcp_ports: The allowed tcp ports + :vartype tcp_ports: str + :ivar udp_ports: The allowed udp ports + :vartype udp_ports: str + """ + + _validation = { + 'connected_resource_id': {'readonly': True}, + 'tcp_ports': {'readonly': True}, + 'udp_ports': {'readonly': True}, + } + + _attribute_map = { + 'connected_resource_id': {'key': 'connectedResourceId', 'type': 'str'}, + 'tcp_ports': {'key': 'tcpPorts', 'type': 'str'}, + 'udp_ports': {'key': 'udpPorts', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ConnectedResource, self).__init__(**kwargs) + self.connected_resource_id = None + self.tcp_ports = None + self.udp_ports = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/connected_resource_py3.py b/azure-mgmt-security/azure/mgmt/security/models/connected_resource_py3.py new file mode 100644 index 000000000000..509629455e1c --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/connected_resource_py3.py @@ -0,0 +1,46 @@ +# 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 ConnectedResource(Model): + """Describes properties of a connected resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar connected_resource_id: The Azure resource id of the connected + resource + :vartype connected_resource_id: str + :ivar tcp_ports: The allowed tcp ports + :vartype tcp_ports: str + :ivar udp_ports: The allowed udp ports + :vartype udp_ports: str + """ + + _validation = { + 'connected_resource_id': {'readonly': True}, + 'tcp_ports': {'readonly': True}, + 'udp_ports': {'readonly': True}, + } + + _attribute_map = { + 'connected_resource_id': {'key': 'connectedResourceId', 'type': 'str'}, + 'tcp_ports': {'key': 'tcpPorts', 'type': 'str'}, + 'udp_ports': {'key': 'udpPorts', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ConnectedResource, self).__init__(**kwargs) + self.connected_resource_id = None + self.tcp_ports = None + self.udp_ports = 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 64f3905e4f14..951d2c9525c7 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 @@ -81,3 +81,9 @@ class ExternalSecuritySolutionKind(str, Enum): cef = "CEF" ata = "ATA" aad = "AAD" + + +class ConnectionType(str, Enum): + + internal = "Internal" + external = "External" diff --git a/azure-mgmt-security/azure/mgmt/security/models/security_contact.py b/azure-mgmt-security/azure/mgmt/security/models/security_contact.py index 95f1211214fd..43926670b0ec 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/security_contact.py +++ b/azure-mgmt-security/azure/mgmt/security/models/security_contact.py @@ -28,7 +28,7 @@ class SecurityContact(Resource): :vartype type: str :param email: Required. The email of this security contact :type email: str - :param phone: Required. The phone number of this security contact + :param phone: The phone number of this security contact :type phone: str :param alert_notifications: Required. Whether to send security alerts notifications to the security contact. Possible values include: 'On', @@ -45,7 +45,6 @@ class SecurityContact(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'email': {'required': True}, - 'phone': {'required': True}, 'alert_notifications': {'required': True}, 'alerts_to_admins': {'required': True}, } diff --git a/azure-mgmt-security/azure/mgmt/security/models/security_contact_py3.py b/azure-mgmt-security/azure/mgmt/security/models/security_contact_py3.py index 5142ff09660c..6a78f995545a 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/security_contact_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/security_contact_py3.py @@ -28,7 +28,7 @@ class SecurityContact(Resource): :vartype type: str :param email: Required. The email of this security contact :type email: str - :param phone: Required. The phone number of this security contact + :param phone: The phone number of this security contact :type phone: str :param alert_notifications: Required. Whether to send security alerts notifications to the security contact. Possible values include: 'On', @@ -45,7 +45,6 @@ class SecurityContact(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'email': {'required': True}, - 'phone': {'required': True}, 'alert_notifications': {'required': True}, 'alerts_to_admins': {'required': True}, } @@ -60,7 +59,7 @@ class SecurityContact(Resource): 'alerts_to_admins': {'key': 'properties.alertsToAdmins', 'type': 'str'}, } - def __init__(self, *, email: str, phone: str, alert_notifications, alerts_to_admins, **kwargs) -> None: + def __init__(self, *, email: str, alert_notifications, alerts_to_admins, phone: str=None, **kwargs) -> None: super(SecurityContact, self).__init__(**kwargs) self.email = email self.phone = phone diff --git a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py index 14d284151ba7..cc451ba3dd54 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/__init__.py @@ -25,6 +25,7 @@ from .jit_network_access_policies_operations import JitNetworkAccessPoliciesOperations from .external_security_solutions_operations import ExternalSecuritySolutionsOperations from .topology_operations import TopologyOperations +from .allowed_connections_operations import AllowedConnectionsOperations __all__ = [ 'PricingsOperations', @@ -43,4 +44,5 @@ 'JitNetworkAccessPoliciesOperations', 'ExternalSecuritySolutionsOperations', 'TopologyOperations', + 'AllowedConnectionsOperations', ] diff --git a/azure-mgmt-security/azure/mgmt/security/operations/allowed_connections_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/allowed_connections_operations.py new file mode 100644 index 000000000000..2d97b7366913 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/operations/allowed_connections_operations.py @@ -0,0 +1,236 @@ +# 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 AllowedConnectionsOperations(object): + """AllowedConnectionsOperations 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 the list of all possible traffic between 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 AllowedConnectionsResource + :rtype: + ~azure.mgmt.security.models.AllowedConnectionsResourcePaged[~azure.mgmt.security.models.AllowedConnectionsResource] + :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.AllowedConnectionsResourcePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.AllowedConnectionsResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections'} + + def list_by_home_region( + self, custom_headers=None, raw=False, **operation_config): + """Gets the list of all possible traffic between resources for the + subscription and location. + + :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 AllowedConnectionsResource + :rtype: + ~azure.mgmt.security.models.AllowedConnectionsResourcePaged[~azure.mgmt.security.models.AllowedConnectionsResource] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_home_region.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}$'), + 'ascLocation': self._serialize.url("self.config.asc_location", self.config.asc_location, '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.AllowedConnectionsResourcePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.AllowedConnectionsResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_home_region.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections'} + + def get( + self, resource_group_name, connection_type, custom_headers=None, raw=False, **operation_config): + """Gets the list of all possible traffic between resources for the + subscription and location, based on connection type. + + :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 connection_type: The type of allowed connections (Internal, + External). Possible values include: 'Internal', 'External' + :type connection_type: str or + ~azure.mgmt.security.models.ConnectionType + :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: AllowedConnectionsResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.AllowedConnectionsResource 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\._\(\)]+$'), + 'ascLocation': self._serialize.url("self.config.asc_location", self.config.asc_location, 'str'), + 'connectionType': self._serialize.url("connection_type", connection_type, '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('AllowedConnectionsResource', 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/locations/{ascLocation}/allowedConnections/{connectionType}'} diff --git a/azure-mgmt-security/azure/mgmt/security/security_center.py b/azure-mgmt-security/azure/mgmt/security/security_center.py index a51e73196e67..4a70b5762f4f 100644 --- a/azure-mgmt-security/azure/mgmt/security/security_center.py +++ b/azure-mgmt-security/azure/mgmt/security/security_center.py @@ -29,6 +29,7 @@ from .operations.jit_network_access_policies_operations import JitNetworkAccessPoliciesOperations from .operations.external_security_solutions_operations import ExternalSecuritySolutionsOperations from .operations.topology_operations import TopologyOperations +from .operations.allowed_connections_operations import AllowedConnectionsOperations from . import models @@ -108,6 +109,8 @@ class SecurityCenter(SDKClient): :vartype external_security_solutions: azure.mgmt.security.operations.ExternalSecuritySolutionsOperations :ivar topology: Topology operations :vartype topology: azure.mgmt.security.operations.TopologyOperations + :ivar allowed_connections: AllowedConnections operations + :vartype allowed_connections: azure.mgmt.security.operations.AllowedConnectionsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -162,3 +165,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.topology = TopologyOperations( self._client, self.config, self._serialize, self._deserialize) + self.allowed_connections = AllowedConnectionsOperations( + self._client, self.config, self._serialize, self._deserialize)