From 54419dd8cf8f602707835a9beeb8277f739e65a7 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 31 Jan 2020 19:48:39 +0000 Subject: [PATCH] Generated from a1386f365386f37a4423ea8d5287fd7fc3344412 trigger build --- .../azure/mgmt/network/_operations_mixin.py | 188 +++++++ .../network/v2019_09_01/models/__init__.py | 30 ++ .../network/v2019_09_01/models/_models.py | 261 ++++++++++ .../network/v2019_09_01/models/_models_py3.py | 261 ++++++++++ .../_network_management_client_enums.py | 6 + .../v2019_09_01/models/_paged_models.py | 26 + .../_network_management_client_operations.py | 461 ++++++++++++++++++ .../network/v2019_11_01/models/__init__.py | 30 ++ .../network/v2019_11_01/models/_models.py | 265 +++++++++- .../network/v2019_11_01/models/_models_py3.py | 265 +++++++++- .../_network_management_client_enums.py | 6 + .../v2019_11_01/models/_paged_models.py | 26 + .../_network_management_client_operations.py | 461 ++++++++++++++++++ 13 files changed, 2282 insertions(+), 4 deletions(-) diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/_operations_mixin.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/_operations_mixin.py index 27dc39749faf..1e0f87c07dd8 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/_operations_mixin.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/_operations_mixin.py @@ -97,6 +97,79 @@ def check_dns_name_availability(self, location, domain_name_label, custom_header mixin_instance.api_version = api_version return mixin_instance.check_dns_name_availability(location, domain_name_label, custom_headers, raw, **operation_config) + def delete_bastion_shareable_link(self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes the Bastion Shareable Links for all the VMs specified in the + request. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + :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` + + """ + api_version = self._get_api_version('delete_bastion_shareable_link') + if api_version == '2019-09-01': + from .v2019_09_01.operations import NetworkManagementClientOperationsMixin as OperationClass + elif api_version == '2019-11-01': + from .v2019_11_01.operations import NetworkManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance.config = self.config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + mixin_instance.api_version = api_version + return mixin_instance.delete_bastion_shareable_link(resource_group_name, bastion_host_name, vms, custom_headers, raw, polling, **operation_config) + + def disconnect_active_sessions(self, resource_group_name, bastion_host_name, session_ids=None, custom_headers=None, raw=False, **operation_config): + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param session_ids: List of session ids + :type session_ids: list[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 BastionSessionState + :rtype: + ~azure.mgmt.network.v2019_11_01.models.BastionSessionStatePaged[~azure.mgmt.network.v2019_11_01.models.BastionSessionState] + :raises: :class:`CloudError` + + """ + api_version = self._get_api_version('disconnect_active_sessions') + if api_version == '2019-09-01': + from .v2019_09_01.operations import NetworkManagementClientOperationsMixin as OperationClass + elif api_version == '2019-11-01': + from .v2019_11_01.operations import NetworkManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance.config = self.config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + mixin_instance.api_version = api_version + return mixin_instance.disconnect_active_sessions(resource_group_name, bastion_host_name, session_ids, custom_headers, raw, **operation_config) + def generatevirtualwanvpnserverconfigurationvpnprofile(self, resource_group_name, virtual_wan_name, vpn_server_configuration_resource_id=None, authentication_method=None, custom_headers=None, raw=False, polling=True, **operation_config): """Generates a unique VPN profile for P2S clients for VirtualWan and associated VpnServerConfiguration combination in the specified resource @@ -145,6 +218,121 @@ def generatevirtualwanvpnserverconfigurationvpnprofile(self, resource_group_name mixin_instance.api_version = api_version return mixin_instance.generatevirtualwanvpnserverconfigurationvpnprofile(resource_group_name, virtual_wan_name, vpn_server_configuration_resource_id, authentication_method, custom_headers, raw, polling, **operation_config) + def get_active_sessions(self, resource_group_name, bastion_host_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_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 + BastionActiveSessionListResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2019_11_01.models.BastionActiveSessionListResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.network.v2019_11_01.models.BastionActiveSessionListResult]] + :raises: :class:`CloudError` + + """ + api_version = self._get_api_version('get_active_sessions') + if api_version == '2019-09-01': + from .v2019_09_01.operations import NetworkManagementClientOperationsMixin as OperationClass + elif api_version == '2019-11-01': + from .v2019_11_01.operations import NetworkManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance.config = self.config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + mixin_instance.api_version = api_version + return mixin_instance.get_active_sessions(resource_group_name, bastion_host_name, custom_headers, raw, polling, **operation_config) + + def get_bastion_shareable_link(self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, **operation_config): + """Return the Bastion Shareable Links for all the VMs specified in the + request. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + :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 BastionShareableLink + :rtype: + ~azure.mgmt.network.v2019_11_01.models.BastionShareableLinkPaged[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + :raises: :class:`CloudError` + + """ + api_version = self._get_api_version('get_bastion_shareable_link') + if api_version == '2019-09-01': + from .v2019_09_01.operations import NetworkManagementClientOperationsMixin as OperationClass + elif api_version == '2019-11-01': + from .v2019_11_01.operations import NetworkManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance.config = self.config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + mixin_instance.api_version = api_version + return mixin_instance.get_bastion_shareable_link(resource_group_name, bastion_host_name, vms, custom_headers, raw, **operation_config) + + def put_bastion_shareable_link(self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a Bastion Shareable Links for all the VMs specified in the + request. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + :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 + BastionShareableLinkListResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2019_11_01.models.BastionShareableLinkListResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.network.v2019_11_01.models.BastionShareableLinkListResult]] + :raises: :class:`CloudError` + + """ + api_version = self._get_api_version('put_bastion_shareable_link') + if api_version == '2019-09-01': + from .v2019_09_01.operations import NetworkManagementClientOperationsMixin as OperationClass + elif api_version == '2019-11-01': + from .v2019_11_01.operations import NetworkManagementClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance.config = self.config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + mixin_instance.api_version = api_version + return mixin_instance.put_bastion_shareable_link(resource_group_name, bastion_host_name, vms, custom_headers, raw, polling, **operation_config) + def supported_security_providers(self, resource_group_name, virtual_wan_name, custom_headers=None, raw=False, **operation_config): """Gives the supported security providers for the virtual wan. diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/__init__.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/__init__.py index 0c8ebf4d2469..fc695653691c 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/__init__.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/__init__.py @@ -87,8 +87,14 @@ from ._models_py3 import AzureReachabilityReportLocation from ._models_py3 import AzureReachabilityReportParameters from ._models_py3 import BackendAddressPool + from ._models_py3 import BastionActiveSession + from ._models_py3 import BastionActiveSessionListResult from ._models_py3 import BastionHost from ._models_py3 import BastionHostIPConfiguration + from ._models_py3 import BastionSessionState + from ._models_py3 import BastionShareableLink + from ._models_py3 import BastionShareableLinkListRequest + from ._models_py3 import BastionShareableLinkListResult from ._models_py3 import BGPCommunity from ._models_py3 import BgpPeerStatus from ._models_py3 import BgpPeerStatusListResult @@ -295,6 +301,7 @@ from ._models_py3 import ServiceTagInformation from ._models_py3 import ServiceTagInformationPropertiesFormat from ._models_py3 import ServiceTagsListResult + from ._models_py3 import SessionIds from ._models_py3 import Subnet from ._models_py3 import SubnetAssociation from ._models_py3 import SubResource @@ -340,6 +347,7 @@ from ._models_py3 import VirtualWanSecurityProvider from ._models_py3 import VirtualWanSecurityProviders from ._models_py3 import VirtualWanVpnProfileParameters + from ._models_py3 import VM from ._models_py3 import VpnClientConfiguration from ._models_py3 import VpnClientConnectionHealth from ._models_py3 import VpnClientConnectionHealthDetail @@ -446,8 +454,14 @@ from ._models import AzureReachabilityReportLocation from ._models import AzureReachabilityReportParameters from ._models import BackendAddressPool + from ._models import BastionActiveSession + from ._models import BastionActiveSessionListResult from ._models import BastionHost from ._models import BastionHostIPConfiguration + from ._models import BastionSessionState + from ._models import BastionShareableLink + from ._models import BastionShareableLinkListRequest + from ._models import BastionShareableLinkListResult from ._models import BGPCommunity from ._models import BgpPeerStatus from ._models import BgpPeerStatusListResult @@ -654,6 +668,7 @@ from ._models import ServiceTagInformation from ._models import ServiceTagInformationPropertiesFormat from ._models import ServiceTagsListResult + from ._models import SessionIds from ._models import Subnet from ._models import SubnetAssociation from ._models import SubResource @@ -699,6 +714,7 @@ from ._models import VirtualWanSecurityProvider from ._models import VirtualWanSecurityProviders from ._models import VirtualWanVpnProfileParameters + from ._models import VM from ._models import VpnClientConfiguration from ._models import VpnClientConnectionHealth from ._models import VpnClientConnectionHealthDetail @@ -738,6 +754,8 @@ from ._paged_models import AzureFirewallPaged from ._paged_models import BackendAddressPoolPaged from ._paged_models import BastionHostPaged +from ._paged_models import BastionSessionStatePaged +from ._paged_models import BastionShareableLinkPaged from ._paged_models import BgpServiceCommunityPaged from ._paged_models import ConnectionMonitorResultPaged from ._paged_models import DdosProtectionPlanPaged @@ -840,6 +858,7 @@ AzureFirewallThreatIntelMode, AzureFirewallSkuName, AzureFirewallSkuTier, + BastionConnectProtocol, DdosCustomPolicyProtocol, DdosCustomPolicyTriggerSensitivityOverride, AuthorizationUseStatus, @@ -1005,8 +1024,14 @@ 'AzureReachabilityReportLocation', 'AzureReachabilityReportParameters', 'BackendAddressPool', + 'BastionActiveSession', + 'BastionActiveSessionListResult', 'BastionHost', 'BastionHostIPConfiguration', + 'BastionSessionState', + 'BastionShareableLink', + 'BastionShareableLinkListRequest', + 'BastionShareableLinkListResult', 'BGPCommunity', 'BgpPeerStatus', 'BgpPeerStatusListResult', @@ -1213,6 +1238,7 @@ 'ServiceTagInformation', 'ServiceTagInformationPropertiesFormat', 'ServiceTagsListResult', + 'SessionIds', 'Subnet', 'SubnetAssociation', 'SubResource', @@ -1258,6 +1284,7 @@ 'VirtualWanSecurityProvider', 'VirtualWanSecurityProviders', 'VirtualWanVpnProfileParameters', + 'VM', 'VpnClientConfiguration', 'VpnClientConnectionHealth', 'VpnClientConnectionHealthDetail', @@ -1294,6 +1321,8 @@ 'AzureFirewallPaged', 'AzureFirewallFqdnTagPaged', 'BastionHostPaged', + 'BastionShareableLinkPaged', + 'BastionSessionStatePaged', 'DdosProtectionPlanPaged', 'EndpointServiceResultPaged', 'ExpressRouteCircuitAuthorizationPaged', @@ -1398,6 +1427,7 @@ 'AzureFirewallThreatIntelMode', 'AzureFirewallSkuName', 'AzureFirewallSkuTier', + 'BastionConnectProtocol', 'DdosCustomPolicyProtocol', 'DdosCustomPolicyTriggerSensitivityOverride', 'AuthorizationUseStatus', diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_models.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_models.py index c2269c7d6b73..81f098c77804 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_models.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_models.py @@ -3506,6 +3506,104 @@ def __init__(self, **kwargs): self.type = None +class BastionActiveSession(Model): + """The session detail for a target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar session_id: A unique id for the session. + :vartype session_id: str + :ivar start_time: The time when the session started. + :vartype start_time: object + :ivar target_subscription_id: The subscription id for the target virtual + machine. + :vartype target_subscription_id: str + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :ivar target_host_name: The host name of the target. + :vartype target_host_name: str + :ivar target_resource_group: The resource group of the target. + :vartype target_resource_group: str + :ivar user_name: The user name who is active on this session. + :vartype user_name: str + :ivar target_ip_address: The IP Address of the target. + :vartype target_ip_address: str + :ivar protocol: The protocol used to connect to the target. Possible + values include: 'SSH', 'RDP' + :vartype protocol: str or + ~azure.mgmt.network.v2019_09_01.models.BastionConnectProtocol + :ivar target_resource_id: The resource id of the target. + :vartype target_resource_id: str + :ivar session_duration_in_mins: Duration in mins the session has been + active. + :vartype session_duration_in_mins: float + """ + + _validation = { + 'session_id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'target_subscription_id': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'target_host_name': {'readonly': True}, + 'target_resource_group': {'readonly': True}, + 'user_name': {'readonly': True}, + 'target_ip_address': {'readonly': True}, + 'protocol': {'readonly': True}, + 'target_resource_id': {'readonly': True}, + 'session_duration_in_mins': {'readonly': True}, + } + + _attribute_map = { + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'object'}, + 'target_subscription_id': {'key': 'targetSubscriptionId', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'target_host_name': {'key': 'targetHostName', 'type': 'str'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + 'user_name': {'key': 'userName', 'type': 'str'}, + 'target_ip_address': {'key': 'targetIpAddress', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + 'session_duration_in_mins': {'key': 'sessionDurationInMins', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(BastionActiveSession, self).__init__(**kwargs) + self.session_id = None + self.start_time = None + self.target_subscription_id = None + self.resource_type = None + self.target_host_name = None + self.target_resource_group = None + self.user_name = None + self.target_ip_address = None + self.protocol = None + self.target_resource_id = None + self.session_duration_in_mins = None + + +class BastionActiveSessionListResult(Model): + """Response for GetActiveSessions. + + :param value: List of active sessions on the bastion. + :type value: + list[~azure.mgmt.network.v2019_09_01.models.BastionActiveSession] + :param next_link: Gets or sets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BastionActiveSession]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BastionActiveSessionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class BastionHost(Resource): """Bastion Host resource. @@ -3629,6 +3727,118 @@ def __init__(self, **kwargs): self.type = None +class BastionSessionState(Model): + """The session state detail for a target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar session_id: A unique id for the session. + :vartype session_id: str + :ivar message: Used for extra information. + :vartype message: str + :ivar state: The state of the session. Disconnected/Failed/NotFound. + :vartype state: str + """ + + _validation = { + 'session_id': {'readonly': True}, + 'message': {'readonly': True}, + 'state': {'readonly': True}, + } + + _attribute_map = { + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BastionSessionState, self).__init__(**kwargs) + self.session_id = None + self.message = None + self.state = None + + +class BastionShareableLink(Model): + """Bastion Shareable Link. + + 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. + + :param vm: Required. Reference of the virtual machine resource. + :type vm: ~azure.mgmt.network.v2019_09_01.models.VM + :ivar bsl: The unique Bastion Shareable Link to the virtual machine. + :vartype bsl: str + :ivar created_at: The time when the link was created. + :vartype created_at: str + :ivar message: Optional field indicating the warning or error message + related to the vm in case of partial failure + :vartype message: str + """ + + _validation = { + 'vm': {'required': True}, + 'bsl': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'vm': {'key': 'vm', 'type': 'VM'}, + 'bsl': {'key': 'bsl', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BastionShareableLink, self).__init__(**kwargs) + self.vm = kwargs.get('vm', None) + self.bsl = None + self.created_at = None + self.message = None + + +class BastionShareableLinkListRequest(Model): + """Post request for all the Bastion Shareable Link endpoints. + + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_09_01.models.BastionShareableLink] + """ + + _attribute_map = { + 'vms': {'key': 'vms', 'type': '[BastionShareableLink]'}, + } + + def __init__(self, **kwargs): + super(BastionShareableLinkListRequest, self).__init__(**kwargs) + self.vms = kwargs.get('vms', None) + + +class BastionShareableLinkListResult(Model): + """Response for all the Bastion Shareable Link endpoints. + + :param value: List of Bastion Shareable Links for the request. + :type value: + list[~azure.mgmt.network.v2019_09_01.models.BastionShareableLink] + :param next_link: Gets or sets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BastionShareableLink]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BastionShareableLinkListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class BGPCommunity(Model): """Contains bgp community information offered in Service Community resources. @@ -12801,6 +13011,22 @@ def __init__(self, **kwargs): self.values = None +class SessionIds(Model): + """List of session ids. + + :param session_ids: List of session ids + :type session_ids: list[str] + """ + + _attribute_map = { + 'session_ids': {'key': 'sessionIds', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(SessionIds, self).__init__(**kwargs) + self.session_ids = kwargs.get('session_ids', None) + + class Subnet(SubResource): """Subnet in a virtual network resource. @@ -14970,6 +15196,41 @@ def __init__(self, **kwargs): self.authentication_method = kwargs.get('authentication_method', None) +class VM(Resource): + """Describes a Virtual Machine. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: Resource ID. + :type id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(VM, self).__init__(**kwargs) + + class VpnClientConfiguration(Model): """VpnClientConfiguration for P2S client. diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_models_py3.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_models_py3.py index 47d38626a539..e602e82a4ef5 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_models_py3.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_models_py3.py @@ -3506,6 +3506,104 @@ def __init__(self, *, id: str=None, name: str=None, **kwargs) -> None: self.type = None +class BastionActiveSession(Model): + """The session detail for a target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar session_id: A unique id for the session. + :vartype session_id: str + :ivar start_time: The time when the session started. + :vartype start_time: object + :ivar target_subscription_id: The subscription id for the target virtual + machine. + :vartype target_subscription_id: str + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :ivar target_host_name: The host name of the target. + :vartype target_host_name: str + :ivar target_resource_group: The resource group of the target. + :vartype target_resource_group: str + :ivar user_name: The user name who is active on this session. + :vartype user_name: str + :ivar target_ip_address: The IP Address of the target. + :vartype target_ip_address: str + :ivar protocol: The protocol used to connect to the target. Possible + values include: 'SSH', 'RDP' + :vartype protocol: str or + ~azure.mgmt.network.v2019_09_01.models.BastionConnectProtocol + :ivar target_resource_id: The resource id of the target. + :vartype target_resource_id: str + :ivar session_duration_in_mins: Duration in mins the session has been + active. + :vartype session_duration_in_mins: float + """ + + _validation = { + 'session_id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'target_subscription_id': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'target_host_name': {'readonly': True}, + 'target_resource_group': {'readonly': True}, + 'user_name': {'readonly': True}, + 'target_ip_address': {'readonly': True}, + 'protocol': {'readonly': True}, + 'target_resource_id': {'readonly': True}, + 'session_duration_in_mins': {'readonly': True}, + } + + _attribute_map = { + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'object'}, + 'target_subscription_id': {'key': 'targetSubscriptionId', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'target_host_name': {'key': 'targetHostName', 'type': 'str'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + 'user_name': {'key': 'userName', 'type': 'str'}, + 'target_ip_address': {'key': 'targetIpAddress', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + 'session_duration_in_mins': {'key': 'sessionDurationInMins', 'type': 'float'}, + } + + def __init__(self, **kwargs) -> None: + super(BastionActiveSession, self).__init__(**kwargs) + self.session_id = None + self.start_time = None + self.target_subscription_id = None + self.resource_type = None + self.target_host_name = None + self.target_resource_group = None + self.user_name = None + self.target_ip_address = None + self.protocol = None + self.target_resource_id = None + self.session_duration_in_mins = None + + +class BastionActiveSessionListResult(Model): + """Response for GetActiveSessions. + + :param value: List of active sessions on the bastion. + :type value: + list[~azure.mgmt.network.v2019_09_01.models.BastionActiveSession] + :param next_link: Gets or sets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BastionActiveSession]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + super(BastionActiveSessionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class BastionHost(Resource): """Bastion Host resource. @@ -3629,6 +3727,118 @@ def __init__(self, *, subnet, public_ip_address, id: str=None, private_ip_alloca self.type = None +class BastionSessionState(Model): + """The session state detail for a target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar session_id: A unique id for the session. + :vartype session_id: str + :ivar message: Used for extra information. + :vartype message: str + :ivar state: The state of the session. Disconnected/Failed/NotFound. + :vartype state: str + """ + + _validation = { + 'session_id': {'readonly': True}, + 'message': {'readonly': True}, + 'state': {'readonly': True}, + } + + _attribute_map = { + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(BastionSessionState, self).__init__(**kwargs) + self.session_id = None + self.message = None + self.state = None + + +class BastionShareableLink(Model): + """Bastion Shareable Link. + + 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. + + :param vm: Required. Reference of the virtual machine resource. + :type vm: ~azure.mgmt.network.v2019_09_01.models.VM + :ivar bsl: The unique Bastion Shareable Link to the virtual machine. + :vartype bsl: str + :ivar created_at: The time when the link was created. + :vartype created_at: str + :ivar message: Optional field indicating the warning or error message + related to the vm in case of partial failure + :vartype message: str + """ + + _validation = { + 'vm': {'required': True}, + 'bsl': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'vm': {'key': 'vm', 'type': 'VM'}, + 'bsl': {'key': 'bsl', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, vm, **kwargs) -> None: + super(BastionShareableLink, self).__init__(**kwargs) + self.vm = vm + self.bsl = None + self.created_at = None + self.message = None + + +class BastionShareableLinkListRequest(Model): + """Post request for all the Bastion Shareable Link endpoints. + + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_09_01.models.BastionShareableLink] + """ + + _attribute_map = { + 'vms': {'key': 'vms', 'type': '[BastionShareableLink]'}, + } + + def __init__(self, *, vms=None, **kwargs) -> None: + super(BastionShareableLinkListRequest, self).__init__(**kwargs) + self.vms = vms + + +class BastionShareableLinkListResult(Model): + """Response for all the Bastion Shareable Link endpoints. + + :param value: List of Bastion Shareable Links for the request. + :type value: + list[~azure.mgmt.network.v2019_09_01.models.BastionShareableLink] + :param next_link: Gets or sets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BastionShareableLink]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + super(BastionShareableLinkListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class BGPCommunity(Model): """Contains bgp community information offered in Service Community resources. @@ -12801,6 +13011,22 @@ def __init__(self, **kwargs) -> None: self.values = None +class SessionIds(Model): + """List of session ids. + + :param session_ids: List of session ids + :type session_ids: list[str] + """ + + _attribute_map = { + 'session_ids': {'key': 'sessionIds', 'type': '[str]'}, + } + + def __init__(self, *, session_ids=None, **kwargs) -> None: + super(SessionIds, self).__init__(**kwargs) + self.session_ids = session_ids + + class Subnet(SubResource): """Subnet in a virtual network resource. @@ -14970,6 +15196,41 @@ def __init__(self, *, vpn_server_configuration_resource_id: str=None, authentica self.authentication_method = authentication_method +class VM(Resource): + """Describes a Virtual Machine. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: Resource ID. + :type id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, id: str=None, location: str=None, tags=None, **kwargs) -> None: + super(VM, self).__init__(id=id, location=location, tags=tags, **kwargs) + + class VpnClientConfiguration(Model): """VpnClientConfiguration for P2S client. diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_network_management_client_enums.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_network_management_client_enums.py index 449ff3a2cd6b..2e284e1557c6 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_network_management_client_enums.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_network_management_client_enums.py @@ -261,6 +261,12 @@ class AzureFirewallSkuTier(str, Enum): standard = "Standard" +class BastionConnectProtocol(str, Enum): + + ssh = "SSH" + rdp = "RDP" + + class DdosCustomPolicyProtocol(str, Enum): tcp = "Tcp" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_paged_models.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_paged_models.py index 240e7e91be33..ca3f6e0931ae 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_paged_models.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/models/_paged_models.py @@ -116,6 +116,32 @@ class BastionHostPaged(Paged): def __init__(self, *args, **kwargs): super(BastionHostPaged, self).__init__(*args, **kwargs) +class BastionShareableLinkPaged(Paged): + """ + A paging container for iterating over a list of :class:`BastionShareableLink ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BastionShareableLink]'} + } + + def __init__(self, *args, **kwargs): + + super(BastionShareableLinkPaged, self).__init__(*args, **kwargs) +class BastionSessionStatePaged(Paged): + """ + A paging container for iterating over a list of :class:`BastionSessionState ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BastionSessionState]'} + } + + def __init__(self, *args, **kwargs): + + super(BastionSessionStatePaged, self).__init__(*args, **kwargs) class DdosProtectionPlanPaged(Paged): """ A paging container for iterating over a list of :class:`DdosProtectionPlan ` object diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/operations/_network_management_client_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/operations/_network_management_client_operations.py index 0bd380289f57..2a255901c498 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/operations/_network_management_client_operations.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/operations/_network_management_client_operations.py @@ -19,6 +19,467 @@ class NetworkManagementClientOperationsMixin(object): + + def _put_bastion_shareable_link_initial( + self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, **operation_config): + bsl_request = models.BastionShareableLinkListRequest(vms=vms) + + api_version = "2019-09-01" + + # Construct URL + url = self.put_bastion_shareable_link.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'bastionHostName': self._serialize.url("bastion_host_name", bastion_host_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", 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(bsl_request, 'BastionShareableLinkListRequest') + + # 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BastionShareableLinkListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def put_bastion_shareable_link( + self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a Bastion Shareable Links for all the VMs specified in the + request. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_09_01.models.BastionShareableLink] + :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 + BastionShareableLinkListResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2019_09_01.models.BastionShareableLinkListResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.network.v2019_09_01.models.BastionShareableLinkListResult]] + :raises: :class:`CloudError` + """ + raw_result = self._put_bastion_shareable_link_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + vms=vms, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('BastionShareableLinkListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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) + put_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks'} + + + def _delete_bastion_shareable_link_initial( + self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, **operation_config): + bsl_request = models.BastionShareableLinkListRequest(vms=vms) + + api_version = "2019-09-01" + + # Construct URL + url = self.delete_bastion_shareable_link.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'bastionHostName': self._serialize.url("bastion_host_name", bastion_host_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", 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(bsl_request, 'BastionShareableLinkListRequest') + + # 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 delete_bastion_shareable_link( + self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes the Bastion Shareable Links for all the VMs specified in the + request. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_09_01.models.BastionShareableLink] + :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._delete_bastion_shareable_link_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + vms=vms, + 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, lro_options={'final-state-via': 'location'}, **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) + delete_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks'} + + def get_bastion_shareable_link( + self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, **operation_config): + """Return the Bastion Shareable Links for all the VMs specified in the + request. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_09_01.models.BastionShareableLink] + :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 BastionShareableLink + :rtype: + ~azure.mgmt.network.v2019_09_01.models.BastionShareableLinkPaged[~azure.mgmt.network.v2019_09_01.models.BastionShareableLink] + :raises: :class:`CloudError` + """ + bsl_request = models.BastionShareableLinkListRequest(vms=vms) + + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.get_bastion_shareable_link.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'bastionHostName': self._serialize.url("bastion_host_name", bastion_host_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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(bsl_request, 'BastionShareableLinkListRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.BastionShareableLinkPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + get_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getShareableLinks'} + + + def _get_active_sessions_initial( + self, resource_group_name, bastion_host_name, custom_headers=None, raw=False, **operation_config): + api_version = "2019-09-01" + + # Construct URL + url = self.get_active_sessions.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'bastionHostName': self._serialize.url("bastion_host_name", bastion_host_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", 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.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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BastionActiveSessionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_active_sessions( + self, resource_group_name, bastion_host_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_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 + BastionActiveSessionListResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2019_09_01.models.BastionActiveSessionListResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.network.v2019_09_01.models.BastionActiveSessionListResult]] + :raises: :class:`CloudError` + """ + raw_result = self._get_active_sessions_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('BastionActiveSessionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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) + get_active_sessions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions'} + + def disconnect_active_sessions( + self, resource_group_name, bastion_host_name, session_ids=None, custom_headers=None, raw=False, **operation_config): + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param session_ids: List of session ids + :type session_ids: list[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 BastionSessionState + :rtype: + ~azure.mgmt.network.v2019_09_01.models.BastionSessionStatePaged[~azure.mgmt.network.v2019_09_01.models.BastionSessionState] + :raises: :class:`CloudError` + """ + session_ids1 = models.SessionIds(session_ids=session_ids) + + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.disconnect_active_sessions.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'bastionHostName': self._serialize.url("bastion_host_name", bastion_host_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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(session_ids1, 'SessionIds') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.BastionSessionStatePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + disconnect_active_sessions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions'} + def check_dns_name_availability( self, location, domain_name_label, custom_headers=None, raw=False, **operation_config): """Checks whether a domain name in the cloudapp.azure.com zone is diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/__init__.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/__init__.py index bb6a69641c8d..49a66a198888 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/__init__.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/__init__.py @@ -89,8 +89,14 @@ from ._models_py3 import AzureReachabilityReportLocation from ._models_py3 import AzureReachabilityReportParameters from ._models_py3 import BackendAddressPool + from ._models_py3 import BastionActiveSession + from ._models_py3 import BastionActiveSessionListResult from ._models_py3 import BastionHost from ._models_py3 import BastionHostIPConfiguration + from ._models_py3 import BastionSessionState + from ._models_py3 import BastionShareableLink + from ._models_py3 import BastionShareableLinkListRequest + from ._models_py3 import BastionShareableLinkListResult from ._models_py3 import BGPCommunity from ._models_py3 import BgpPeerStatus from ._models_py3 import BgpPeerStatusListResult @@ -310,6 +316,7 @@ from ._models_py3 import ServiceTagInformation from ._models_py3 import ServiceTagInformationPropertiesFormat from ._models_py3 import ServiceTagsListResult + from ._models_py3 import SessionIds from ._models_py3 import Subnet from ._models_py3 import SubnetAssociation from ._models_py3 import SubResource @@ -355,6 +362,7 @@ from ._models_py3 import VirtualWanSecurityProvider from ._models_py3 import VirtualWanSecurityProviders from ._models_py3 import VirtualWanVpnProfileParameters + from ._models_py3 import VM from ._models_py3 import VpnClientConfiguration from ._models_py3 import VpnClientConnectionHealth from ._models_py3 import VpnClientConnectionHealthDetail @@ -463,8 +471,14 @@ from ._models import AzureReachabilityReportLocation from ._models import AzureReachabilityReportParameters from ._models import BackendAddressPool + from ._models import BastionActiveSession + from ._models import BastionActiveSessionListResult from ._models import BastionHost from ._models import BastionHostIPConfiguration + from ._models import BastionSessionState + from ._models import BastionShareableLink + from ._models import BastionShareableLinkListRequest + from ._models import BastionShareableLinkListResult from ._models import BGPCommunity from ._models import BgpPeerStatus from ._models import BgpPeerStatusListResult @@ -684,6 +698,7 @@ from ._models import ServiceTagInformation from ._models import ServiceTagInformationPropertiesFormat from ._models import ServiceTagsListResult + from ._models import SessionIds from ._models import Subnet from ._models import SubnetAssociation from ._models import SubResource @@ -729,6 +744,7 @@ from ._models import VirtualWanSecurityProvider from ._models import VirtualWanSecurityProviders from ._models import VirtualWanVpnProfileParameters + from ._models import VM from ._models import VpnClientConfiguration from ._models import VpnClientConnectionHealth from ._models import VpnClientConnectionHealthDetail @@ -768,6 +784,8 @@ from ._paged_models import AzureFirewallPaged from ._paged_models import BackendAddressPoolPaged from ._paged_models import BastionHostPaged +from ._paged_models import BastionSessionStatePaged +from ._paged_models import BastionShareableLinkPaged from ._paged_models import BgpServiceCommunityPaged from ._paged_models import ConnectionMonitorResultPaged from ._paged_models import DdosProtectionPlanPaged @@ -871,6 +889,7 @@ AzureFirewallThreatIntelMode, AzureFirewallSkuName, AzureFirewallSkuTier, + BastionConnectProtocol, DdosCustomPolicyProtocol, DdosCustomPolicyTriggerSensitivityOverride, AuthorizationUseStatus, @@ -1045,8 +1064,14 @@ 'AzureReachabilityReportLocation', 'AzureReachabilityReportParameters', 'BackendAddressPool', + 'BastionActiveSession', + 'BastionActiveSessionListResult', 'BastionHost', 'BastionHostIPConfiguration', + 'BastionSessionState', + 'BastionShareableLink', + 'BastionShareableLinkListRequest', + 'BastionShareableLinkListResult', 'BGPCommunity', 'BgpPeerStatus', 'BgpPeerStatusListResult', @@ -1266,6 +1291,7 @@ 'ServiceTagInformation', 'ServiceTagInformationPropertiesFormat', 'ServiceTagsListResult', + 'SessionIds', 'Subnet', 'SubnetAssociation', 'SubResource', @@ -1311,6 +1337,7 @@ 'VirtualWanSecurityProvider', 'VirtualWanSecurityProviders', 'VirtualWanVpnProfileParameters', + 'VM', 'VpnClientConfiguration', 'VpnClientConnectionHealth', 'VpnClientConnectionHealthDetail', @@ -1347,6 +1374,8 @@ 'AzureFirewallPaged', 'AzureFirewallFqdnTagPaged', 'BastionHostPaged', + 'BastionShareableLinkPaged', + 'BastionSessionStatePaged', 'DdosProtectionPlanPaged', 'EndpointServiceResultPaged', 'ExpressRouteCircuitAuthorizationPaged', @@ -1452,6 +1481,7 @@ 'AzureFirewallThreatIntelMode', 'AzureFirewallSkuName', 'AzureFirewallSkuTier', + 'BastionConnectProtocol', 'DdosCustomPolicyProtocol', 'DdosCustomPolicyTriggerSensitivityOverride', 'AuthorizationUseStatus', diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_models.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_models.py index ab06597e0f9e..7ee0fb1fb8fc 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_models.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_models.py @@ -3584,6 +3584,104 @@ def __init__(self, **kwargs): self.type = None +class BastionActiveSession(Model): + """The session detail for a target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar session_id: A unique id for the session. + :vartype session_id: str + :ivar start_time: The time when the session started. + :vartype start_time: object + :ivar target_subscription_id: The subscription id for the target virtual + machine. + :vartype target_subscription_id: str + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :ivar target_host_name: The host name of the target. + :vartype target_host_name: str + :ivar target_resource_group: The resource group of the target. + :vartype target_resource_group: str + :ivar user_name: The user name who is active on this session. + :vartype user_name: str + :ivar target_ip_address: The IP Address of the target. + :vartype target_ip_address: str + :ivar protocol: The protocol used to connect to the target. Possible + values include: 'SSH', 'RDP' + :vartype protocol: str or + ~azure.mgmt.network.v2019_11_01.models.BastionConnectProtocol + :ivar target_resource_id: The resource id of the target. + :vartype target_resource_id: str + :ivar session_duration_in_mins: Duration in mins the session has been + active. + :vartype session_duration_in_mins: float + """ + + _validation = { + 'session_id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'target_subscription_id': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'target_host_name': {'readonly': True}, + 'target_resource_group': {'readonly': True}, + 'user_name': {'readonly': True}, + 'target_ip_address': {'readonly': True}, + 'protocol': {'readonly': True}, + 'target_resource_id': {'readonly': True}, + 'session_duration_in_mins': {'readonly': True}, + } + + _attribute_map = { + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'object'}, + 'target_subscription_id': {'key': 'targetSubscriptionId', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'target_host_name': {'key': 'targetHostName', 'type': 'str'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + 'user_name': {'key': 'userName', 'type': 'str'}, + 'target_ip_address': {'key': 'targetIpAddress', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + 'session_duration_in_mins': {'key': 'sessionDurationInMins', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(BastionActiveSession, self).__init__(**kwargs) + self.session_id = None + self.start_time = None + self.target_subscription_id = None + self.resource_type = None + self.target_host_name = None + self.target_resource_group = None + self.user_name = None + self.target_ip_address = None + self.protocol = None + self.target_resource_id = None + self.session_duration_in_mins = None + + +class BastionActiveSessionListResult(Model): + """Response for GetActiveSessions. + + :param value: List of active sessions on the bastion. + :type value: + list[~azure.mgmt.network.v2019_11_01.models.BastionActiveSession] + :param next_link: Gets or sets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BastionActiveSession]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BastionActiveSessionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class BastionHost(Resource): """Bastion Host resource. @@ -3653,9 +3751,9 @@ class BastionHostIPConfiguration(SubResource): :param id: Resource ID. :type id: str - :param subnet: Required. Reference to the subnet resource. + :param subnet: Required. Reference of the subnet resource. :type subnet: ~azure.mgmt.network.v2019_11_01.models.SubResource - :param public_ip_address: Required. Reference to the PublicIP resource. + :param public_ip_address: Required. Reference of the PublicIP resource. :type public_ip_address: ~azure.mgmt.network.v2019_11_01.models.SubResource :ivar provisioning_state: The provisioning state of the bastion host IP @@ -3707,6 +3805,118 @@ def __init__(self, **kwargs): self.type = None +class BastionSessionState(Model): + """The session state detail for a target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar session_id: A unique id for the session. + :vartype session_id: str + :ivar message: Used for extra information. + :vartype message: str + :ivar state: The state of the session. Disconnected/Failed/NotFound. + :vartype state: str + """ + + _validation = { + 'session_id': {'readonly': True}, + 'message': {'readonly': True}, + 'state': {'readonly': True}, + } + + _attribute_map = { + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BastionSessionState, self).__init__(**kwargs) + self.session_id = None + self.message = None + self.state = None + + +class BastionShareableLink(Model): + """Bastion Shareable Link. + + 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. + + :param vm: Required. Reference of the virtual machine resource. + :type vm: ~azure.mgmt.network.v2019_11_01.models.VM + :ivar bsl: The unique Bastion Shareable Link to the virtual machine. + :vartype bsl: str + :ivar created_at: The time when the link was created. + :vartype created_at: str + :ivar message: Optional field indicating the warning or error message + related to the vm in case of partial failure + :vartype message: str + """ + + _validation = { + 'vm': {'required': True}, + 'bsl': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'vm': {'key': 'vm', 'type': 'VM'}, + 'bsl': {'key': 'bsl', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BastionShareableLink, self).__init__(**kwargs) + self.vm = kwargs.get('vm', None) + self.bsl = None + self.created_at = None + self.message = None + + +class BastionShareableLinkListRequest(Model): + """Post request for all the Bastion Shareable Link endpoints. + + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + """ + + _attribute_map = { + 'vms': {'key': 'vms', 'type': '[BastionShareableLink]'}, + } + + def __init__(self, **kwargs): + super(BastionShareableLinkListRequest, self).__init__(**kwargs) + self.vms = kwargs.get('vms', None) + + +class BastionShareableLinkListResult(Model): + """Response for all the Bastion Shareable Link endpoints. + + :param value: List of Bastion Shareable Links for the request. + :type value: + list[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + :param next_link: Gets or sets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BastionShareableLink]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BastionShareableLinkListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class BGPCommunity(Model): """Contains bgp community information offered in Service Community resources. @@ -13375,6 +13585,22 @@ def __init__(self, **kwargs): self.values = None +class SessionIds(Model): + """List of session ids. + + :param session_ids: List of session ids + :type session_ids: list[str] + """ + + _attribute_map = { + 'session_ids': {'key': 'sessionIds', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(SessionIds, self).__init__(**kwargs) + self.session_ids = kwargs.get('session_ids', None) + + class Subnet(SubResource): """Subnet in a virtual network resource. @@ -15532,6 +15758,41 @@ def __init__(self, **kwargs): self.authentication_method = kwargs.get('authentication_method', None) +class VM(Resource): + """Describes a Virtual Machine. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: Resource ID. + :type id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(VM, self).__init__(**kwargs) + + class VpnClientConfiguration(Model): """VpnClientConfiguration for P2S client. diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_models_py3.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_models_py3.py index 69ba900bf291..b636d47f852d 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_models_py3.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_models_py3.py @@ -3584,6 +3584,104 @@ def __init__(self, *, id: str=None, name: str=None, **kwargs) -> None: self.type = None +class BastionActiveSession(Model): + """The session detail for a target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar session_id: A unique id for the session. + :vartype session_id: str + :ivar start_time: The time when the session started. + :vartype start_time: object + :ivar target_subscription_id: The subscription id for the target virtual + machine. + :vartype target_subscription_id: str + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :ivar target_host_name: The host name of the target. + :vartype target_host_name: str + :ivar target_resource_group: The resource group of the target. + :vartype target_resource_group: str + :ivar user_name: The user name who is active on this session. + :vartype user_name: str + :ivar target_ip_address: The IP Address of the target. + :vartype target_ip_address: str + :ivar protocol: The protocol used to connect to the target. Possible + values include: 'SSH', 'RDP' + :vartype protocol: str or + ~azure.mgmt.network.v2019_11_01.models.BastionConnectProtocol + :ivar target_resource_id: The resource id of the target. + :vartype target_resource_id: str + :ivar session_duration_in_mins: Duration in mins the session has been + active. + :vartype session_duration_in_mins: float + """ + + _validation = { + 'session_id': {'readonly': True}, + 'start_time': {'readonly': True}, + 'target_subscription_id': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'target_host_name': {'readonly': True}, + 'target_resource_group': {'readonly': True}, + 'user_name': {'readonly': True}, + 'target_ip_address': {'readonly': True}, + 'protocol': {'readonly': True}, + 'target_resource_id': {'readonly': True}, + 'session_duration_in_mins': {'readonly': True}, + } + + _attribute_map = { + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'object'}, + 'target_subscription_id': {'key': 'targetSubscriptionId', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'target_host_name': {'key': 'targetHostName', 'type': 'str'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + 'user_name': {'key': 'userName', 'type': 'str'}, + 'target_ip_address': {'key': 'targetIpAddress', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + 'session_duration_in_mins': {'key': 'sessionDurationInMins', 'type': 'float'}, + } + + def __init__(self, **kwargs) -> None: + super(BastionActiveSession, self).__init__(**kwargs) + self.session_id = None + self.start_time = None + self.target_subscription_id = None + self.resource_type = None + self.target_host_name = None + self.target_resource_group = None + self.user_name = None + self.target_ip_address = None + self.protocol = None + self.target_resource_id = None + self.session_duration_in_mins = None + + +class BastionActiveSessionListResult(Model): + """Response for GetActiveSessions. + + :param value: List of active sessions on the bastion. + :type value: + list[~azure.mgmt.network.v2019_11_01.models.BastionActiveSession] + :param next_link: Gets or sets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BastionActiveSession]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + super(BastionActiveSessionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class BastionHost(Resource): """Bastion Host resource. @@ -3653,9 +3751,9 @@ class BastionHostIPConfiguration(SubResource): :param id: Resource ID. :type id: str - :param subnet: Required. Reference to the subnet resource. + :param subnet: Required. Reference of the subnet resource. :type subnet: ~azure.mgmt.network.v2019_11_01.models.SubResource - :param public_ip_address: Required. Reference to the PublicIP resource. + :param public_ip_address: Required. Reference of the PublicIP resource. :type public_ip_address: ~azure.mgmt.network.v2019_11_01.models.SubResource :ivar provisioning_state: The provisioning state of the bastion host IP @@ -3707,6 +3805,118 @@ def __init__(self, *, subnet, public_ip_address, id: str=None, private_ip_alloca self.type = None +class BastionSessionState(Model): + """The session state detail for a target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar session_id: A unique id for the session. + :vartype session_id: str + :ivar message: Used for extra information. + :vartype message: str + :ivar state: The state of the session. Disconnected/Failed/NotFound. + :vartype state: str + """ + + _validation = { + 'session_id': {'readonly': True}, + 'message': {'readonly': True}, + 'state': {'readonly': True}, + } + + _attribute_map = { + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(BastionSessionState, self).__init__(**kwargs) + self.session_id = None + self.message = None + self.state = None + + +class BastionShareableLink(Model): + """Bastion Shareable Link. + + 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. + + :param vm: Required. Reference of the virtual machine resource. + :type vm: ~azure.mgmt.network.v2019_11_01.models.VM + :ivar bsl: The unique Bastion Shareable Link to the virtual machine. + :vartype bsl: str + :ivar created_at: The time when the link was created. + :vartype created_at: str + :ivar message: Optional field indicating the warning or error message + related to the vm in case of partial failure + :vartype message: str + """ + + _validation = { + 'vm': {'required': True}, + 'bsl': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'vm': {'key': 'vm', 'type': 'VM'}, + 'bsl': {'key': 'bsl', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, vm, **kwargs) -> None: + super(BastionShareableLink, self).__init__(**kwargs) + self.vm = vm + self.bsl = None + self.created_at = None + self.message = None + + +class BastionShareableLinkListRequest(Model): + """Post request for all the Bastion Shareable Link endpoints. + + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + """ + + _attribute_map = { + 'vms': {'key': 'vms', 'type': '[BastionShareableLink]'}, + } + + def __init__(self, *, vms=None, **kwargs) -> None: + super(BastionShareableLinkListRequest, self).__init__(**kwargs) + self.vms = vms + + +class BastionShareableLinkListResult(Model): + """Response for all the Bastion Shareable Link endpoints. + + :param value: List of Bastion Shareable Links for the request. + :type value: + list[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + :param next_link: Gets or sets the URL to get the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BastionShareableLink]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + super(BastionShareableLinkListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class BGPCommunity(Model): """Contains bgp community information offered in Service Community resources. @@ -13375,6 +13585,22 @@ def __init__(self, **kwargs) -> None: self.values = None +class SessionIds(Model): + """List of session ids. + + :param session_ids: List of session ids + :type session_ids: list[str] + """ + + _attribute_map = { + 'session_ids': {'key': 'sessionIds', 'type': '[str]'}, + } + + def __init__(self, *, session_ids=None, **kwargs) -> None: + super(SessionIds, self).__init__(**kwargs) + self.session_ids = session_ids + + class Subnet(SubResource): """Subnet in a virtual network resource. @@ -15532,6 +15758,41 @@ def __init__(self, *, vpn_server_configuration_resource_id: str=None, authentica self.authentication_method = authentication_method +class VM(Resource): + """Describes a Virtual Machine. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: Resource ID. + :type id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, id: str=None, location: str=None, tags=None, **kwargs) -> None: + super(VM, self).__init__(id=id, location=location, tags=tags, **kwargs) + + class VpnClientConfiguration(Model): """VpnClientConfiguration for P2S client. diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_network_management_client_enums.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_network_management_client_enums.py index 1905775402ba..1d053ffb371d 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_network_management_client_enums.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_network_management_client_enums.py @@ -261,6 +261,12 @@ class AzureFirewallSkuTier(str, Enum): standard = "Standard" +class BastionConnectProtocol(str, Enum): + + ssh = "SSH" + rdp = "RDP" + + class DdosCustomPolicyProtocol(str, Enum): tcp = "Tcp" diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_paged_models.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_paged_models.py index 4b25937e1e48..d40474767560 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_paged_models.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/models/_paged_models.py @@ -116,6 +116,32 @@ class BastionHostPaged(Paged): def __init__(self, *args, **kwargs): super(BastionHostPaged, self).__init__(*args, **kwargs) +class BastionShareableLinkPaged(Paged): + """ + A paging container for iterating over a list of :class:`BastionShareableLink ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BastionShareableLink]'} + } + + def __init__(self, *args, **kwargs): + + super(BastionShareableLinkPaged, self).__init__(*args, **kwargs) +class BastionSessionStatePaged(Paged): + """ + A paging container for iterating over a list of :class:`BastionSessionState ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BastionSessionState]'} + } + + def __init__(self, *args, **kwargs): + + super(BastionSessionStatePaged, self).__init__(*args, **kwargs) class DdosProtectionPlanPaged(Paged): """ A paging container for iterating over a list of :class:`DdosProtectionPlan ` object diff --git a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/operations/_network_management_client_operations.py b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/operations/_network_management_client_operations.py index f87d7f6143b8..447e09d0a57f 100644 --- a/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/operations/_network_management_client_operations.py +++ b/sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/operations/_network_management_client_operations.py @@ -19,6 +19,467 @@ class NetworkManagementClientOperationsMixin(object): + + def _put_bastion_shareable_link_initial( + self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, **operation_config): + bsl_request = models.BastionShareableLinkListRequest(vms=vms) + + api_version = "2019-11-01" + + # Construct URL + url = self.put_bastion_shareable_link.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'bastionHostName': self._serialize.url("bastion_host_name", bastion_host_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", 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(bsl_request, 'BastionShareableLinkListRequest') + + # 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BastionShareableLinkListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def put_bastion_shareable_link( + self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a Bastion Shareable Links for all the VMs specified in the + request. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + :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 + BastionShareableLinkListResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2019_11_01.models.BastionShareableLinkListResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.network.v2019_11_01.models.BastionShareableLinkListResult]] + :raises: :class:`CloudError` + """ + raw_result = self._put_bastion_shareable_link_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + vms=vms, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('BastionShareableLinkListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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) + put_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks'} + + + def _delete_bastion_shareable_link_initial( + self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, **operation_config): + bsl_request = models.BastionShareableLinkListRequest(vms=vms) + + api_version = "2019-11-01" + + # Construct URL + url = self.delete_bastion_shareable_link.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'bastionHostName': self._serialize.url("bastion_host_name", bastion_host_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", 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(bsl_request, 'BastionShareableLinkListRequest') + + # 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 delete_bastion_shareable_link( + self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes the Bastion Shareable Links for all the VMs specified in the + request. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + :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._delete_bastion_shareable_link_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + vms=vms, + 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, lro_options={'final-state-via': 'location'}, **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) + delete_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks'} + + def get_bastion_shareable_link( + self, resource_group_name, bastion_host_name, vms=None, custom_headers=None, raw=False, **operation_config): + """Return the Bastion Shareable Links for all the VMs specified in the + request. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param vms: List of VM references. + :type vms: + list[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + :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 BastionShareableLink + :rtype: + ~azure.mgmt.network.v2019_11_01.models.BastionShareableLinkPaged[~azure.mgmt.network.v2019_11_01.models.BastionShareableLink] + :raises: :class:`CloudError` + """ + bsl_request = models.BastionShareableLinkListRequest(vms=vms) + + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.get_bastion_shareable_link.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'bastionHostName': self._serialize.url("bastion_host_name", bastion_host_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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(bsl_request, 'BastionShareableLinkListRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.BastionShareableLinkPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + get_bastion_shareable_link.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getShareableLinks'} + + + def _get_active_sessions_initial( + self, resource_group_name, bastion_host_name, custom_headers=None, raw=False, **operation_config): + api_version = "2019-11-01" + + # Construct URL + url = self.get_active_sessions.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'bastionHostName': self._serialize.url("bastion_host_name", bastion_host_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", 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.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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BastionActiveSessionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_active_sessions( + self, resource_group_name, bastion_host_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_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 + BastionActiveSessionListResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2019_11_01.models.BastionActiveSessionListResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.network.v2019_11_01.models.BastionActiveSessionListResult]] + :raises: :class:`CloudError` + """ + raw_result = self._get_active_sessions_initial( + resource_group_name=resource_group_name, + bastion_host_name=bastion_host_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('BastionActiveSessionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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) + get_active_sessions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions'} + + def disconnect_active_sessions( + self, resource_group_name, bastion_host_name, session_ids=None, custom_headers=None, raw=False, **operation_config): + """Returns the list of currently active sessions on the Bastion. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param bastion_host_name: The name of the Bastion Host. + :type bastion_host_name: str + :param session_ids: List of session ids + :type session_ids: list[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 BastionSessionState + :rtype: + ~azure.mgmt.network.v2019_11_01.models.BastionSessionStatePaged[~azure.mgmt.network.v2019_11_01.models.BastionSessionState] + :raises: :class:`CloudError` + """ + session_ids1 = models.SessionIds(session_ids=session_ids) + + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.disconnect_active_sessions.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'bastionHostName': self._serialize.url("bastion_host_name", bastion_host_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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(session_ids1, 'SessionIds') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.BastionSessionStatePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + disconnect_active_sessions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions'} + def check_dns_name_availability( self, location, domain_name_label, custom_headers=None, raw=False, **operation_config): """Checks whether a domain name in the cloudapp.azure.com zone is