diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/address_space.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/address_space.py index 4ff6fb3af6d8..d7050c78a457 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/address_space.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/address_space.py @@ -26,4 +26,5 @@ class AddressSpace(Model): } def __init__(self, address_prefixes=None): + super(AddressSpace, self).__init__() self.address_prefixes = address_prefixes diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/application_gateway_backend_address.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/application_gateway_backend_address.py index 5ff5ce4b4a5c..6005027d0845 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/application_gateway_backend_address.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/application_gateway_backend_address.py @@ -27,5 +27,6 @@ class ApplicationGatewayBackendAddress(Model): } def __init__(self, fqdn=None, ip_address=None): + super(ApplicationGatewayBackendAddress, self).__init__() self.fqdn = fqdn self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/application_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/application_gateway_sku.py index b9c02d5debd2..1e646a414c9d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/application_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/application_gateway_sku.py @@ -36,6 +36,7 @@ class ApplicationGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(ApplicationGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/azure_async_operation_result.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/azure_async_operation_result.py index a48adcbfd10b..a234024931a0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/azure_async_operation_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/azure_async_operation_result.py @@ -37,5 +37,6 @@ class AzureAsyncOperationResult(Model): } def __init__(self, status=None, error=None): + super(AzureAsyncOperationResult, self).__init__() self.status = status self.error = error diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/bgp_settings.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/bgp_settings.py index 7b544629260f..ecfc9b46feda 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/bgp_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/bgp_settings.py @@ -32,6 +32,7 @@ class BgpSettings(Model): } def __init__(self, asn=None, bgp_peering_address=None, peer_weight=None): + super(BgpSettings, self).__init__() self.asn = asn self.bgp_peering_address = bgp_peering_address self.peer_weight = peer_weight diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_reset_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_reset_shared_key.py index c99bd204b83b..b59ba480d6c1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_reset_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_reset_shared_key.py @@ -24,4 +24,5 @@ class ConnectionResetSharedKey(Model): } def __init__(self, key_length=None): + super(ConnectionResetSharedKey, self).__init__() self.key_length = key_length diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_shared_key.py index c224625b5c49..ac9b02ae25c4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_shared_key.py @@ -24,4 +24,5 @@ class ConnectionSharedKey(Model): } def __init__(self, value=None): + super(ConnectionSharedKey, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_shared_key_result.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_shared_key_result.py index d7414417093a..dad934a10b4a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_shared_key_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/connection_shared_key_result.py @@ -24,4 +24,5 @@ class ConnectionSharedKeyResult(Model): } def __init__(self, value=None): + super(ConnectionSharedKeyResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/dhcp_options.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/dhcp_options.py index 2262eb5ec2f1..8744ba6fc9b1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/dhcp_options.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/dhcp_options.py @@ -26,4 +26,5 @@ class DhcpOptions(Model): } def __init__(self, dns_servers=None): + super(DhcpOptions, self).__init__() self.dns_servers = dns_servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/dns_name_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/dns_name_availability_result.py index 4be1851d2f59..15a0238e49a7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/dns_name_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/dns_name_availability_result.py @@ -24,4 +24,5 @@ class DnsNameAvailabilityResult(Model): } def __init__(self, available=None): + super(DnsNameAvailabilityResult, self).__init__() self.available = available diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/error.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/error.py index 6bba7a4ba8c5..5bebec6c5cad 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/error.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/error.py @@ -36,6 +36,7 @@ class Error(Model): } def __init__(self, code=None, message=None, target=None, details=None, inner_error=None): + super(Error, self).__init__() self.code = code self.message = message self.target = target diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/error_details.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/error_details.py index 578d020f8154..0fd95b8f5cad 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/error_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/error_details.py @@ -30,6 +30,7 @@ class ErrorDetails(Model): } def __init__(self, code=None, target=None, message=None): + super(ErrorDetails, self).__init__() self.code = code self.target = target self.message = message diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_arp_table.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_arp_table.py index 027757e879af..cd824b686344 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_arp_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_arp_table.py @@ -27,5 +27,6 @@ class ExpressRouteCircuitArpTable(Model): } def __init__(self, ip_address=None, mac_address=None): + super(ExpressRouteCircuitArpTable, self).__init__() self.ip_address = ip_address self.mac_address = mac_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_peering_config.py index 7ae426a4f029..ffbe729f3c1b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_peering_config.py @@ -39,6 +39,7 @@ class ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, advertised_public_prefixes=None, advertised_public_prefixes_state=None, customer_asn=None, routing_registry_name=None): + super(ExpressRouteCircuitPeeringConfig, self).__init__() self.advertised_public_prefixes = advertised_public_prefixes self.advertised_public_prefixes_state = advertised_public_prefixes_state self.customer_asn = customer_asn diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_routes_table.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_routes_table.py index 766b19d0009f..0373f5115c31 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_routes_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_routes_table.py @@ -40,6 +40,7 @@ class ExpressRouteCircuitRoutesTable(Model): } def __init__(self, next_hop_type, address_prefix=None, next_hop_ip=None, as_path=None): + super(ExpressRouteCircuitRoutesTable, self).__init__() self.address_prefix = address_prefix self.next_hop_type = next_hop_type self.next_hop_ip = next_hop_ip diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_service_provider_properties.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_service_provider_properties.py index b7ada851e235..7a6b4ba96061 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_service_provider_properties.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_service_provider_properties.py @@ -30,6 +30,7 @@ class ExpressRouteCircuitServiceProviderProperties(Model): } def __init__(self, service_provider_name=None, peering_location=None, bandwidth_in_mbps=None): + super(ExpressRouteCircuitServiceProviderProperties, self).__init__() self.service_provider_name = service_provider_name self.peering_location = peering_location self.bandwidth_in_mbps = bandwidth_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_sku.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_sku.py index 1edda894782f..9ebdde1d6a5e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_sku.py @@ -34,6 +34,7 @@ class ExpressRouteCircuitSku(Model): } def __init__(self, name=None, tier=None, family=None): + super(ExpressRouteCircuitSku, self).__init__() self.name = name self.tier = tier self.family = family diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_stats.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_stats.py index 70bb0e6be699..f11899cdc03f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_stats.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_circuit_stats.py @@ -27,5 +27,6 @@ class ExpressRouteCircuitStats(Model): } def __init__(self, bytes_in=None, bytes_out=None): + super(ExpressRouteCircuitStats, self).__init__() self.bytes_in = bytes_in self.bytes_out = bytes_out diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_service_provider_bandwidths_offered.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_service_provider_bandwidths_offered.py index b1b2c8a76447..9cbba2fcfe97 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_service_provider_bandwidths_offered.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/express_route_service_provider_bandwidths_offered.py @@ -27,5 +27,6 @@ class ExpressRouteServiceProviderBandwidthsOffered(Model): } def __init__(self, offer_name=None, value_in_mbps=None): + super(ExpressRouteServiceProviderBandwidthsOffered, self).__init__() self.offer_name = offer_name self.value_in_mbps = value_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/network_interface_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/network_interface_dns_settings.py index dcb1193b0d01..dc60cbe8fba3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/network_interface_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/network_interface_dns_settings.py @@ -41,6 +41,7 @@ class NetworkInterfaceDnsSettings(Model): } def __init__(self, dns_servers=None, applied_dns_servers=None, internal_dns_name_label=None, internal_fqdn=None): + super(NetworkInterfaceDnsSettings, self).__init__() self.dns_servers = dns_servers self.applied_dns_servers = applied_dns_servers self.internal_dns_name_label = internal_dns_name_label diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/public_ip_address_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/public_ip_address_dns_settings.py index 65a534407848..a248461f05d7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/public_ip_address_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/public_ip_address_dns_settings.py @@ -39,6 +39,7 @@ class PublicIPAddressDnsSettings(Model): } def __init__(self, domain_name_label=None, fqdn=None, reverse_fqdn=None): + super(PublicIPAddressDnsSettings, self).__init__() self.domain_name_label = domain_name_label self.fqdn = fqdn self.reverse_fqdn = reverse_fqdn diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/resource.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/resource.py index 51c7546cbd18..94ff6ae67cd3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/resource.py @@ -44,6 +44,7 @@ class Resource(Model): } def __init__(self, id=None, location=None, tags=None): + super(Resource, self).__init__() self.id = id self.name = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/sub_resource.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/sub_resource.py index a295d4552b0d..27a3d1ca7c6d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/sub_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/sub_resource.py @@ -24,4 +24,5 @@ class SubResource(Model): } def __init__(self, id=None): + super(SubResource, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/usage.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/usage.py index 25fabf3a593e..39d4c7e77e18 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/usage.py @@ -46,6 +46,7 @@ class Usage(Model): unit = "Count" def __init__(self, current_value, limit, name): + super(Usage, self).__init__() self.current_value = current_value self.limit = limit self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/usage_name.py index 87786b60cf62..df7f344bfb9b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/usage_name.py @@ -27,5 +27,6 @@ class UsageName(Model): } def __init__(self, value=None, localized_value=None): + super(UsageName, self).__init__() self.value = value self.localized_value = localized_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/virtual_network_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/virtual_network_gateway_sku.py index d4e6cc16a7c0..045d1db7db2d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/virtual_network_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/virtual_network_gateway_sku.py @@ -34,6 +34,7 @@ class VirtualNetworkGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(VirtualNetworkGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/vpn_client_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/vpn_client_configuration.py index 05f7051b50a3..79216c335b1c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/vpn_client_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/vpn_client_configuration.py @@ -36,6 +36,7 @@ class VpnClientConfiguration(Model): } def __init__(self, vpn_client_address_pool=None, vpn_client_root_certificates=None, vpn_client_revoked_certificates=None): + super(VpnClientConfiguration, self).__init__() self.vpn_client_address_pool = vpn_client_address_pool self.vpn_client_root_certificates = vpn_client_root_certificates self.vpn_client_revoked_certificates = vpn_client_revoked_certificates diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/vpn_client_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/vpn_client_parameters.py index ce5ce384a145..82a458c33efd 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/vpn_client_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/vpn_client_parameters.py @@ -26,4 +26,5 @@ class VpnClientParameters(Model): } def __init__(self, processor_architecture=None): + super(VpnClientParameters, self).__init__() self.processor_architecture = processor_architecture diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/network_management_client.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/network_management_client.py index d295188d3881..a90750a3bc81 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/network_management_client.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/network_management_client.py @@ -221,7 +221,7 @@ def check_dns_name_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/application_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/application_gateways_operations.py index 567f51961f24..cec082493657 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/application_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/application_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def delete( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param parameters: Parameters supplied to the create or update - application gateway operation. - :type parameters: - ~azure.mgmt.network.v2015_06_15.models.ApplicationGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ApplicationGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ApplicationGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update + application gateway operation. + :type parameters: + ~azure.mgmt.network.v2015_06_15.models.ApplicationGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ApplicationGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('ApplicationGateway', response) + deserialized = self._deserialize('ApplicationGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -381,7 +431,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -400,23 +450,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def start( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Starts the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _start_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start' path_format_arguments = { @@ -441,18 +477,58 @@ def start( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def start( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Starts the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._start_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -465,10 +541,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -476,23 +548,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Stops the specified application gateway in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop' path_format_arguments = { @@ -517,18 +575,58 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def stop( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Stops the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -541,10 +639,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuit_authorizations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuit_authorizations_operations.py index d8a322561c07..153eba27e3c5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuit_authorizations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuit_authorizations_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified authorization from the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified authorization from the specified express route + circuit. - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,31 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an authorization in the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param authorization_parameters: Parameters supplied to the create or - update express route circuit authorization operation. - :type authorization_parameters: - ~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuitAuthorization - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuitAuthorization] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -238,19 +240,78 @@ def create_or_update( body_content = self._serialize.body(authorization_parameters, 'ExpressRouteCircuitAuthorization') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization in the specified express route + circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or + update express route circuit authorization operation. + :type authorization_parameters: + ~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuitAuthorization + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuitAuthorization] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + authorization_parameters=authorization_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -259,12 +320,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -272,10 +328,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuit_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuit_peerings_operations.py index 10f346615438..f9e32e615c18 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuit_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuit_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified peering from the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified peering from the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified express route circuits. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param peering_parameters: Parameters supplied to the create or update - express route circuit peering operation. - :type peering_parameters: - ~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuitPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuitPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(peering_parameters, 'ExpressRouteCircuitPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + express route circuit peering operation. + :type peering_parameters: + ~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuitPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuitPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + peering_parameters=peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuits_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuits_operations.py index 5416aa2acede..e8f3e0125833 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuits_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_circuits_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the circuit. - :type circuit_name: str - :param parameters: Parameters supplied to the create or update express - route circuit operation. - :type parameters: - ~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuit - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuit or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuit] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ExpressRouteCircuit') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuit', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuit', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the circuit. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express + route circuit operation. + :type parameters: + ~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuit + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuit or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ExpressRouteCircuit] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuit', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuit', response) + deserialized = self._deserialize('ExpressRouteCircuit', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -322,7 +372,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -394,7 +444,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -465,7 +515,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -532,7 +582,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -596,7 +646,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_service_providers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_service_providers_operations.py index 31a1229829d0..d060fc328c86 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_service_providers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/express_route_service_providers_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/load_balancers_operations.py index 1f5fb427f966..11b331a7c048 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/load_balancers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param parameters: Parameters supplied to the create or update load - balancer operation. - :type parameters: ~azure.mgmt.network.v2015_06_15.models.LoadBalancer - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns LoadBalancer - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.LoadBalancer] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LoadBalancer') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LoadBalancer', response) + if response.status_code == 201: + deserialized = self._deserialize('LoadBalancer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load + balancer operation. + :type parameters: ~azure.mgmt.network.v2015_06_15.models.LoadBalancer + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns LoadBalancer + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.LoadBalancer] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LoadBalancer', response) - if response.status_code == 201: - deserialized = self._deserialize('LoadBalancer', response) + deserialized = self._deserialize('LoadBalancer', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/local_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/local_network_gateways_operations.py index 07428e430b16..7706113dc606 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/local_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/local_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a local network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param parameters: Parameters supplied to the create or update local - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2015_06_15.models.LocalNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - LocalNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.LocalNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LocalNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocalNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('LocalNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a local network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2015_06_15.models.LocalNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + LocalNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.LocalNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LocalNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('LocalNetworkGateway', response) + deserialized = self._deserialize('LocalNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified local network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified local network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/network_interfaces_operations.py index 847d62fb0ecf..fa29034f3bea 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/network_interfaces_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param parameters: Parameters supplied to the create or update network - interface operation. - :type parameters: - ~azure.mgmt.network.v2015_06_15.models.NetworkInterface - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkInterface or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.NetworkInterface] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkInterface') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkInterface', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkInterface', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network + interface operation. + :type parameters: + ~azure.mgmt.network.v2015_06_15.models.NetworkInterface + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkInterface or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.NetworkInterface] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkInterface', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkInterface', response) + deserialized = self._deserialize('NetworkInterface', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -460,7 +510,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -531,7 +581,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -604,7 +654,7 @@ def get_virtual_machine_scale_set_network_interface( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/network_security_groups_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/network_security_groups_operations.py index ea5225c39cb5..292d61c2676b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/network_security_groups_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/network_security_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,24 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -80,18 +66,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def delete( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -104,10 +131,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network security group in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param parameters: Parameters supplied to the create or update network - security group operation. - :type parameters: - ~azure.mgmt.network.v2015_06_15.models.NetworkSecurityGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.NetworkSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -232,19 +234,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkSecurityGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network security group in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network + security group operation. + :type parameters: + ~azure.mgmt.network.v2015_06_15.models.NetworkSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.NetworkSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkSecurityGroup', response) + deserialized = self._deserialize('NetworkSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -322,7 +372,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -389,7 +439,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/public_ip_addresses_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/public_ip_addresses_operations.py index 6806d7b055aa..31a52a67000f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/public_ip_addresses_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/public_ip_addresses_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the subnet. - :type public_ip_address_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the subnet. + :type public_ip_address_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a static or dynamic public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the public IP address. - :type public_ip_address_name: str - :param parameters: Parameters supplied to the create or update public - IP address operation. - :type parameters: - ~azure.mgmt.network.v2015_06_15.models.PublicIPAddress - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PublicIPAddress or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.PublicIPAddress] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'PublicIPAddress') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PublicIPAddress', response) + if response.status_code == 201: + deserialized = self._deserialize('PublicIPAddress', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public + IP address operation. + :type parameters: + ~azure.mgmt.network.v2015_06_15.models.PublicIPAddress + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PublicIPAddress or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.PublicIPAddress] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PublicIPAddress', response) - if response.status_code == 201: - deserialized = self._deserialize('PublicIPAddress', response) + deserialized = self._deserialize('PublicIPAddress', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/route_tables_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/route_tables_operations.py index 08f61e344e97..4c66d8151a3a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/route_tables_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/route_tables_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create or updates a route table in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param parameters: Parameters supplied to the create or update route - table operation. - :type parameters: ~azure.mgmt.network.v2015_06_15.models.RouteTable - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteTable - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.RouteTable] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'RouteTable') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteTable', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route + table operation. + :type parameters: ~azure.mgmt.network.v2015_06_15.models.RouteTable + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteTable + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.RouteTable] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteTable', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteTable', response) + deserialized = self._deserialize('RouteTable', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -320,7 +370,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/routes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/routes_operations.py index bc29dd03b05d..f8ddf2a6f90b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/routes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/routes_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route from a route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route from a route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,29 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param route_parameters: Parameters supplied to the create or update - route operation. - :type route_parameters: ~azure.mgmt.network.v2015_06_15.models.Route - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Route or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.Route] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -232,19 +236,76 @@ def create_or_update( body_content = self._serialize.body(route_parameters, 'Route') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Route', response) + if response.status_code == 201: + deserialized = self._deserialize('Route', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update + route operation. + :type route_parameters: ~azure.mgmt.network.v2015_06_15.models.Route + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Route or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.Route] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + route_parameters=route_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +314,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Route', response) - if response.status_code == 201: - deserialized = self._deserialize('Route', response) + deserialized = self._deserialize('Route', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +322,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -328,7 +380,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/security_rules_operations.py index 1f86f53db124..f43ce3b5c125 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/security_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,32 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a security rule in the specified network security - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param security_rule_parameters: Parameters supplied to the create or - update network security rule operation. - :type security_rule_parameters: - ~azure.mgmt.network.v2015_06_15.models.SecurityRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns SecurityRule - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.SecurityRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -237,19 +238,79 @@ def create_or_update( body_content = self._serialize.body(security_rule_parameters, 'SecurityRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SecurityRule', response) + if response.status_code == 201: + deserialized = self._deserialize('SecurityRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a security rule in the specified network security + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or + update network security rule operation. + :type security_rule_parameters: + ~azure.mgmt.network.v2015_06_15.models.SecurityRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns SecurityRule + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.SecurityRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + security_rule_parameters=security_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -258,12 +319,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityRule', response) - if response.status_code == 201: - deserialized = self._deserialize('SecurityRule', response) + deserialized = self._deserialize('SecurityRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -271,10 +327,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/subnets_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/subnets_operations.py index e5e0daff0250..b3f03d9ebcba 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/subnets_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/subnets_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified subnet. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified subnet. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,29 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a subnet in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param subnet_parameters: Parameters supplied to the create or update - subnet operation. - :type subnet_parameters: ~azure.mgmt.network.v2015_06_15.models.Subnet - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Subnet or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.Subnet] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -236,19 +240,76 @@ def create_or_update( body_content = self._serialize.body(subnet_parameters, 'Subnet') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Subnet', response) + if response.status_code == 201: + deserialized = self._deserialize('Subnet', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update + subnet operation. + :type subnet_parameters: ~azure.mgmt.network.v2015_06_15.models.Subnet + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Subnet or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.Subnet] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subnet_parameters=subnet_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -257,12 +318,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Subnet', response) - if response.status_code == 201: - deserialized = self._deserialize('Subnet', response) + deserialized = self._deserialize('Subnet', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -270,10 +326,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -332,7 +384,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/usages_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/usages_operations.py index c8bfc22cda7a..636d17f6ca70 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/usages_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/usages_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_network_gateway_connections_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_network_gateway_connections_operations.py index de5da1bdf383..a045682ef2fe 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_network_gateway_connections_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_network_gateway_connections_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway connection in the - specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param parameters: Parameters supplied to the create or update virtual - network gateway connection operation. - :type parameters: - ~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGatewayConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGatewayConnection or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGatewayConnection] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGatewayConnection') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway connection in the + specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual + network gateway connection operation. + :type parameters: + ~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGatewayConnection + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGatewayConnection or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGatewayConnection] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -181,7 +209,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -199,24 +227,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network Gateway connection. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -241,18 +254,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network Gateway connection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -265,10 +319,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -323,7 +373,7 @@ def get_shared_key( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -390,7 +440,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -409,31 +459,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, key_length=None, custom_headers=None, raw=False, **operation_config): - """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection reset shared key Name. - :type virtual_network_gateway_connection_name: str - :param key_length: The virtual network connection reset shared key - length - :type key_length: long - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionResetSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ConnectionResetSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, key_length=None, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionResetSharedKey(key_length=key_length) # Construct URL @@ -463,19 +491,75 @@ def reset_shared_key( body_content = self._serialize.body(parameters, 'ConnectionResetSharedKey') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectionResetSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, key_length=None, custom_headers=None, raw=False, **operation_config): + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection reset shared key Name. + :type virtual_network_gateway_connection_name: str + :param key_length: The virtual network connection reset shared key + length + :type key_length: long + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionResetSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ConnectionResetSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + key_length=key_length, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -484,10 +568,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionResetSharedKey', response) + deserialized = self._deserialize('ConnectionResetSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -495,10 +576,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -506,30 +583,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, value=None, custom_headers=None, raw=False, **operation_config): - """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection name. - :type virtual_network_gateway_connection_name: str - :param value: The virtual network connection shared key value - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ConnectionSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, value=None, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionSharedKey(value=value) # Construct URL @@ -559,19 +615,76 @@ def set_shared_key( body_content = self._serialize.body(parameters, 'ConnectionSharedKey') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConnectionSharedKey', response) + if response.status_code == 201: + deserialized = self._deserialize('ConnectionSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, value=None, custom_headers=None, raw=False, **operation_config): + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection name. + :type virtual_network_gateway_connection_name: str + :param value: The virtual network connection shared key value + :type value: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.ConnectionSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + value=value, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -580,12 +693,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionSharedKey', response) - if response.status_code == 201: - deserialized = self._deserialize('ConnectionSharedKey', response) + deserialized = self._deserialize('ConnectionSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -593,10 +701,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_network_gateways_operations.py index 41d326967dff..5e75e2a0a234 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to create or update virtual - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -340,30 +390,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Resets the primary of the virtual network gateway in the specified - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Virtual network gateway vip address supplied to the - begin reset of the active-active feature enabled gateway. - :type parameters: - ~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset' path_format_arguments = { @@ -391,19 +420,74 @@ def reset( body_content = self._serialize.body(parameters, 'VirtualNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Resets the primary of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Virtual network gateway vip address supplied to the + begin reset of the active-active feature enabled gateway. + :type parameters: + ~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -412,10 +496,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -423,10 +504,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -489,7 +566,7 @@ def generatevpnclientpackage( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [202]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_networks_operations.py b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_networks_operations.py index d930c3e4959b..6e9c59d41e13 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_networks_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/virtual_networks_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network in the specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to the create or update virtual - network operation - :type parameters: - ~azure.mgmt.network.v2015_06_15.models.VirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetwork or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.VirtualNetwork] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetwork') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetwork', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual + network operation + :type parameters: + ~azure.mgmt.network.v2015_06_15.models.VirtualNetwork + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetwork or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2015_06_15.models.VirtualNetwork] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetwork', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetwork', response) + deserialized = self._deserialize('VirtualNetwork', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/address_space.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/address_space.py index 4ff6fb3af6d8..d7050c78a457 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/address_space.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/address_space.py @@ -26,4 +26,5 @@ class AddressSpace(Model): } def __init__(self, address_prefixes=None): + super(AddressSpace, self).__init__() self.address_prefixes = address_prefixes diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_address.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_address.py index 5ff5ce4b4a5c..6005027d0845 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_address.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_address.py @@ -27,5 +27,6 @@ class ApplicationGatewayBackendAddress(Model): } def __init__(self, fqdn=None, ip_address=None): + super(ApplicationGatewayBackendAddress, self).__init__() self.fqdn = fqdn self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health.py index c0d4d4f1216c..11ff30c542ff 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health.py @@ -25,4 +25,5 @@ class ApplicationGatewayBackendHealth(Model): } def __init__(self, backend_address_pools=None): + super(ApplicationGatewayBackendHealth, self).__init__() self.backend_address_pools = backend_address_pools diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_http_settings.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_http_settings.py index 67d2e95dd2d1..b2aefd53b524 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_http_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_http_settings.py @@ -30,5 +30,6 @@ class ApplicationGatewayBackendHealthHttpSettings(Model): } def __init__(self, backend_http_settings=None, servers=None): + super(ApplicationGatewayBackendHealthHttpSettings, self).__init__() self.backend_http_settings = backend_http_settings self.servers = servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_pool.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_pool.py index 006c7d84b432..a67e363cfd24 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_pool.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_pool.py @@ -31,5 +31,6 @@ class ApplicationGatewayBackendHealthPool(Model): } def __init__(self, backend_address_pool=None, backend_http_settings_collection=None): + super(ApplicationGatewayBackendHealthPool, self).__init__() self.backend_address_pool = backend_address_pool self.backend_http_settings_collection = backend_http_settings_collection diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_server.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_server.py index cdd9c9479553..0d05be701cc0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_server.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_backend_health_server.py @@ -33,6 +33,7 @@ class ApplicationGatewayBackendHealthServer(Model): } def __init__(self, address=None, ip_configuration=None, health=None): + super(ApplicationGatewayBackendHealthServer, self).__init__() self.address = address self.ip_configuration = ip_configuration self.health = health diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_sku.py index 92d026e1a1a7..44432d212f9b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_sku.py @@ -36,6 +36,7 @@ class ApplicationGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(ApplicationGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_ssl_policy.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_ssl_policy.py index 309cf485b9e5..a6c5b53cf2f8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_ssl_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_ssl_policy.py @@ -26,4 +26,5 @@ class ApplicationGatewaySslPolicy(Model): } def __init__(self, disabled_ssl_protocols=None): + super(ApplicationGatewaySslPolicy, self).__init__() self.disabled_ssl_protocols = disabled_ssl_protocols diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_web_application_firewall_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_web_application_firewall_configuration.py index 3096b998f05c..161921a261ed 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_web_application_firewall_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/application_gateway_web_application_firewall_configuration.py @@ -34,5 +34,6 @@ class ApplicationGatewayWebApplicationFirewallConfiguration(Model): } def __init__(self, enabled, firewall_mode=None): + super(ApplicationGatewayWebApplicationFirewallConfiguration, self).__init__() self.enabled = enabled self.firewall_mode = firewall_mode diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/azure_async_operation_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/azure_async_operation_result.py index 4256d16b1199..402e6601bb80 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/azure_async_operation_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/azure_async_operation_result.py @@ -37,5 +37,6 @@ class AzureAsyncOperationResult(Model): } def __init__(self, status=None, error=None): + super(AzureAsyncOperationResult, self).__init__() self.status = status self.error = error diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_peer_status.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_peer_status.py index ad8596dd452a..28cc331b36a5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_peer_status.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_peer_status.py @@ -60,6 +60,7 @@ class BgpPeerStatus(Model): } def __init__(self): + super(BgpPeerStatus, self).__init__() self.local_address = None self.neighbor = None self.asn = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_peer_status_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_peer_status_list_result.py index 525d1d6a0d39..7dfc50c1c14a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_peer_status_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_peer_status_list_result.py @@ -24,4 +24,5 @@ class BgpPeerStatusListResult(Model): } def __init__(self, value=None): + super(BgpPeerStatusListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_settings.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_settings.py index b64d10a21139..cd3f5e596a04 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/bgp_settings.py @@ -32,6 +32,7 @@ class BgpSettings(Model): } def __init__(self, asn=None, bgp_peering_address=None, peer_weight=None): + super(BgpSettings, self).__init__() self.asn = asn self.bgp_peering_address = bgp_peering_address self.peer_weight = peer_weight diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/connection_reset_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/connection_reset_shared_key.py index 43eff397461d..c68ade7d79f5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/connection_reset_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/connection_reset_shared_key.py @@ -29,4 +29,5 @@ class ConnectionResetSharedKey(Model): } def __init__(self, key_length): + super(ConnectionResetSharedKey, self).__init__() self.key_length = key_length diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/connection_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/connection_shared_key.py index 0dbbc36cc798..2c1b0ed9a914 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/connection_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/connection_shared_key.py @@ -28,4 +28,5 @@ class ConnectionSharedKey(Model): } def __init__(self, value): + super(ConnectionSharedKey, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/dhcp_options.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/dhcp_options.py index 2262eb5ec2f1..8744ba6fc9b1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/dhcp_options.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/dhcp_options.py @@ -26,4 +26,5 @@ class DhcpOptions(Model): } def __init__(self, dns_servers=None): + super(DhcpOptions, self).__init__() self.dns_servers = dns_servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/dns_name_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/dns_name_availability_result.py index 4be1851d2f59..15a0238e49a7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/dns_name_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/dns_name_availability_result.py @@ -24,4 +24,5 @@ class DnsNameAvailabilityResult(Model): } def __init__(self, available=None): + super(DnsNameAvailabilityResult, self).__init__() self.available = available diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group.py index 73eedce053d0..9d6540b4c12d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group.py @@ -34,6 +34,7 @@ class EffectiveNetworkSecurityGroup(Model): } def __init__(self, network_security_group=None, association=None, effective_security_rules=None): + super(EffectiveNetworkSecurityGroup, self).__init__() self.network_security_group = network_security_group self.association = association self.effective_security_rules = effective_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group_association.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group_association.py index 15d7b1051e5c..69749f112977 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group_association.py @@ -28,5 +28,6 @@ class EffectiveNetworkSecurityGroupAssociation(Model): } def __init__(self, subnet=None, network_interface=None): + super(EffectiveNetworkSecurityGroupAssociation, self).__init__() self.subnet = subnet self.network_interface = network_interface diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group_list_result.py index 9043b9f7990a..0876384ae787 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_group_list_result.py @@ -28,5 +28,6 @@ class EffectiveNetworkSecurityGroupListResult(Model): } def __init__(self, value=None, next_link=None): + super(EffectiveNetworkSecurityGroupListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_rule.py index 1139f1a2d32b..e4e87252b6ac 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_network_security_rule.py @@ -63,6 +63,7 @@ class EffectiveNetworkSecurityRule(Model): } def __init__(self, name=None, protocol=None, source_port_range=None, destination_port_range=None, source_address_prefix=None, destination_address_prefix=None, expanded_source_address_prefix=None, expanded_destination_address_prefix=None, access=None, priority=None, direction=None): + super(EffectiveNetworkSecurityRule, self).__init__() self.name = name self.protocol = protocol self.source_port_range = source_port_range diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_route.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_route.py index f0cebed4e45b..782459c38540 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_route.py @@ -51,6 +51,7 @@ class EffectiveRoute(Model): } def __init__(self, name=None, source=None, state=None, address_prefix=None, next_hop_ip_address=None, next_hop_type=None): + super(EffectiveRoute, self).__init__() self.name = name self.source = source self.state = state diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_route_list_result.py index 1ae64681d067..73dc586ce27a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/effective_route_list_result.py @@ -27,5 +27,6 @@ class EffectiveRouteListResult(Model): } def __init__(self, value=None, next_link=None): + super(EffectiveRouteListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/error.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/error.py index c2a2cf729d6c..d2b1b1cf2ef1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/error.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/error.py @@ -36,6 +36,7 @@ class Error(Model): } def __init__(self, code=None, message=None, target=None, details=None, inner_error=None): + super(Error, self).__init__() self.code = code self.message = message self.target = target diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/error_details.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/error_details.py index 47f2ac4111b1..40bea00aa2fb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/error_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/error_details.py @@ -30,6 +30,7 @@ class ErrorDetails(Model): } def __init__(self, code=None, target=None, message=None): + super(ErrorDetails, self).__init__() self.code = code self.target = target self.message = message diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_arp_table.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_arp_table.py index a2f8f716bf8a..ace325747ee5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_arp_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_arp_table.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitArpTable(Model): } def __init__(self, age=None, interface=None, ip_address=None, mac_address=None): + super(ExpressRouteCircuitArpTable, self).__init__() self.age = age self.interface = interface self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_peering_config.py index fc5f75c6cfe4..2899722ad407 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_peering_config.py @@ -39,6 +39,7 @@ class ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, advertised_public_prefixes=None, advertised_public_prefixes_state=None, customer_asn=None, routing_registry_name=None): + super(ExpressRouteCircuitPeeringConfig, self).__init__() self.advertised_public_prefixes = advertised_public_prefixes self.advertised_public_prefixes_state = advertised_public_prefixes_state self.customer_asn = customer_asn diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_routes_table.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_routes_table.py index e84fae6e0973..804d29a2f9bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_routes_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_routes_table.py @@ -36,6 +36,7 @@ class ExpressRouteCircuitRoutesTable(Model): } def __init__(self, network=None, next_hop=None, loc_prf=None, weight=None, path=None): + super(ExpressRouteCircuitRoutesTable, self).__init__() self.network = network self.next_hop = next_hop self.loc_prf = loc_prf diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_routes_table_summary.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_routes_table_summary.py index 3ff1b42d0c1b..6f5f89764dd4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_routes_table_summary.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_routes_table_summary.py @@ -38,6 +38,7 @@ class ExpressRouteCircuitRoutesTableSummary(Model): } def __init__(self, neighbor=None, v=None, as_property=None, up_down=None, state_pfx_rcd=None): + super(ExpressRouteCircuitRoutesTableSummary, self).__init__() self.neighbor = neighbor self.v = v self.as_property = as_property diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_service_provider_properties.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_service_provider_properties.py index b7ada851e235..7a6b4ba96061 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_service_provider_properties.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_service_provider_properties.py @@ -30,6 +30,7 @@ class ExpressRouteCircuitServiceProviderProperties(Model): } def __init__(self, service_provider_name=None, peering_location=None, bandwidth_in_mbps=None): + super(ExpressRouteCircuitServiceProviderProperties, self).__init__() self.service_provider_name = service_provider_name self.peering_location = peering_location self.bandwidth_in_mbps = bandwidth_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_sku.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_sku.py index f7501074cad9..e5524c749dd6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_sku.py @@ -34,6 +34,7 @@ class ExpressRouteCircuitSku(Model): } def __init__(self, name=None, tier=None, family=None): + super(ExpressRouteCircuitSku, self).__init__() self.name = name self.tier = tier self.family = family diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_stats.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_stats.py index 1215bda40383..e26f6f7d2f74 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_stats.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuit_stats.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitStats(Model): } def __init__(self, primarybytes_in=None, primarybytes_out=None, secondarybytes_in=None, secondarybytes_out=None): + super(ExpressRouteCircuitStats, self).__init__() self.primarybytes_in = primarybytes_in self.primarybytes_out = primarybytes_out self.secondarybytes_in = secondarybytes_in diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_arp_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_arp_table_list_result.py index 749b95eb38a6..f5815585579a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_arp_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_arp_table_list_result.py @@ -28,5 +28,6 @@ class ExpressRouteCircuitsArpTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsArpTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_routes_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_routes_table_list_result.py index 2b30e3615163..f92fbb8fd520 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_routes_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_routes_table_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_routes_table_summary_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_routes_table_summary_list_result.py index 6ba2c47ed4b4..569c861ce662 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_routes_table_summary_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_circuits_routes_table_summary_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableSummaryListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableSummaryListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_service_provider_bandwidths_offered.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_service_provider_bandwidths_offered.py index b1b2c8a76447..9cbba2fcfe97 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_service_provider_bandwidths_offered.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/express_route_service_provider_bandwidths_offered.py @@ -27,5 +27,6 @@ class ExpressRouteServiceProviderBandwidthsOffered(Model): } def __init__(self, offer_name=None, value_in_mbps=None): + super(ExpressRouteServiceProviderBandwidthsOffered, self).__init__() self.offer_name = offer_name self.value_in_mbps = value_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/flow_log_information.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/flow_log_information.py index a4a99d8a14de..24e7f2c047a6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/flow_log_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/flow_log_information.py @@ -42,6 +42,7 @@ class FlowLogInformation(Model): } def __init__(self, target_resource_id, storage_id, enabled, retention_policy=None): + super(FlowLogInformation, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/flow_log_status_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/flow_log_status_parameters.py index 1dae2ff24447..4cd22222bb45 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/flow_log_status_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/flow_log_status_parameters.py @@ -29,4 +29,5 @@ class FlowLogStatusParameters(Model): } def __init__(self, target_resource_id): + super(FlowLogStatusParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/gateway_route.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/gateway_route.py index d62839bba217..b4e542466325 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/gateway_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/gateway_route.py @@ -55,6 +55,7 @@ class GatewayRoute(Model): } def __init__(self): + super(GatewayRoute, self).__init__() self.local_address = None self.network = None self.next_hop = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/gateway_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/gateway_route_list_result.py index 9846d9ba0b50..58a2b7e49823 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/gateway_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/gateway_route_list_result.py @@ -24,4 +24,5 @@ class GatewayRouteListResult(Model): } def __init__(self, value=None): + super(GatewayRouteListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/ip_address_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/ip_address_availability_result.py index 0e26dd91fffc..f2cb36a550ec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/ip_address_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/ip_address_availability_result.py @@ -28,5 +28,6 @@ class IPAddressAvailabilityResult(Model): } def __init__(self, available=None, available_ip_addresses=None): + super(IPAddressAvailabilityResult, self).__init__() self.available = available self.available_ip_addresses = available_ip_addresses diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/network_interface_association.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/network_interface_association.py index bbd439debea8..bfc726978cec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/network_interface_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/network_interface_association.py @@ -35,5 +35,6 @@ class NetworkInterfaceAssociation(Model): } def __init__(self, security_rules=None): + super(NetworkInterfaceAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/network_interface_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/network_interface_dns_settings.py index 110594c2f928..675a4a1eb08a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/network_interface_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/network_interface_dns_settings.py @@ -47,6 +47,7 @@ class NetworkInterfaceDnsSettings(Model): } def __init__(self, dns_servers=None, applied_dns_servers=None, internal_dns_name_label=None, internal_fqdn=None, internal_domain_name_suffix=None): + super(NetworkInterfaceDnsSettings, self).__init__() self.dns_servers = dns_servers self.applied_dns_servers = applied_dns_servers self.internal_dns_name_label = internal_dns_name_label diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/next_hop_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/next_hop_parameters.py index f38a8ce62abb..3e1478409a0a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/next_hop_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/next_hop_parameters.py @@ -42,6 +42,7 @@ class NextHopParameters(Model): } def __init__(self, target_resource_id, source_ip_address, destination_ip_address, target_nic_resource_id=None): + super(NextHopParameters, self).__init__() self.target_resource_id = target_resource_id self.source_ip_address = source_ip_address self.destination_ip_address = destination_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/next_hop_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/next_hop_result.py index 54790934e8b2..645ae73c4519 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/next_hop_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/next_hop_result.py @@ -36,6 +36,7 @@ class NextHopResult(Model): } def __init__(self, next_hop_type=None, next_hop_ip_address=None, route_table_id=None): + super(NextHopResult, self).__init__() self.next_hop_type = next_hop_type self.next_hop_ip_address = next_hop_ip_address self.route_table_id = route_table_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture.py index 781288a8fafb..a940d3ff556f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture.py @@ -50,6 +50,7 @@ class PacketCapture(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCapture, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_filter.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_filter.py index bea497582afb..4ea1e0bd05ad 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_filter.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_filter.py @@ -52,6 +52,7 @@ class PacketCaptureFilter(Model): } def __init__(self, protocol="Any", local_ip_address=None, remote_ip_address=None, local_port=None, remote_port=None): + super(PacketCaptureFilter, self).__init__() self.protocol = protocol self.local_ip_address = local_ip_address self.remote_ip_address = remote_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_parameters.py index 0bba43f07a26..e643fc93902f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_parameters.py @@ -50,6 +50,7 @@ class PacketCaptureParameters(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCaptureParameters, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_query_status_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_query_status_result.py index d4b68209e8d1..d0636567ae72 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_query_status_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_query_status_result.py @@ -44,6 +44,7 @@ class PacketCaptureQueryStatusResult(Model): } def __init__(self, name=None, id=None, capture_start_time=None, packet_capture_status=None, stop_reason=None, packet_capture_error=None): + super(PacketCaptureQueryStatusResult, self).__init__() self.name = name self.id = id self.capture_start_time = capture_start_time diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_result.py index 34492758e7d8..d4949f4636fc 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_result.py @@ -71,6 +71,7 @@ class PacketCaptureResult(Model): } def __init__(self, target, storage_location, etag="A unique read-only string that changes whenever the resource is updated.", bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None, provisioning_state=None): + super(PacketCaptureResult, self).__init__() self.name = None self.id = None self.etag = etag diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_storage_location.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_storage_location.py index d0987d11ff9f..773b04d22501 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_storage_location.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/packet_capture_storage_location.py @@ -36,6 +36,7 @@ class PacketCaptureStorageLocation(Model): } def __init__(self, storage_id=None, storage_path=None, file_path=None): + super(PacketCaptureStorageLocation, self).__init__() self.storage_id = storage_id self.storage_path = storage_path self.file_path = file_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/public_ip_address_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/public_ip_address_dns_settings.py index 65a534407848..a248461f05d7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/public_ip_address_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/public_ip_address_dns_settings.py @@ -39,6 +39,7 @@ class PublicIPAddressDnsSettings(Model): } def __init__(self, domain_name_label=None, fqdn=None, reverse_fqdn=None): + super(PublicIPAddressDnsSettings, self).__init__() self.domain_name_label = domain_name_label self.fqdn = fqdn self.reverse_fqdn = reverse_fqdn diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/query_troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/query_troubleshooting_parameters.py index a394b181fcc5..9b6801eb7b63 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/query_troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/query_troubleshooting_parameters.py @@ -29,4 +29,5 @@ class QueryTroubleshootingParameters(Model): } def __init__(self, target_resource_id): + super(QueryTroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/resource.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/resource.py index 994440bac861..5dfb000318bf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/resource.py @@ -44,6 +44,7 @@ class Resource(Model): } def __init__(self, id=None, location=None, tags=None): + super(Resource, self).__init__() self.id = id self.name = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/retention_policy_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/retention_policy_parameters.py index 58f7f12cc6a9..102f4c5c3b4c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/retention_policy_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/retention_policy_parameters.py @@ -27,5 +27,6 @@ class RetentionPolicyParameters(Model): } def __init__(self, days=0, enabled=False): + super(RetentionPolicyParameters, self).__init__() self.days = days self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_network_interface.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_network_interface.py index 8c1050ca0441..e00822ea9856 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_network_interface.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_network_interface.py @@ -28,5 +28,6 @@ class SecurityGroupNetworkInterface(Model): } def __init__(self, id=None, security_rule_associations=None): + super(SecurityGroupNetworkInterface, self).__init__() self.id = id self.security_rule_associations = security_rule_associations diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_view_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_view_parameters.py index 304908dd4792..5c0972e5d55e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_view_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_view_parameters.py @@ -28,4 +28,5 @@ class SecurityGroupViewParameters(Model): } def __init__(self, target_resource_id): + super(SecurityGroupViewParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_view_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_view_result.py index b78616e27001..52c1cc83015c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_view_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_group_view_result.py @@ -25,4 +25,5 @@ class SecurityGroupViewResult(Model): } def __init__(self, network_interfaces=None): + super(SecurityGroupViewResult, self).__init__() self.network_interfaces = network_interfaces diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_rule_associations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_rule_associations.py index bc3407b4de8a..3b4647d5ee03 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_rule_associations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/security_rule_associations.py @@ -38,6 +38,7 @@ class SecurityRuleAssociations(Model): } def __init__(self, network_interface_association=None, subnet_association=None, default_security_rules=None, effective_security_rules=None): + super(SecurityRuleAssociations, self).__init__() self.network_interface_association = network_interface_association self.subnet_association = subnet_association self.default_security_rules = default_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/sub_resource.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/sub_resource.py index e7fa13135e83..d4a564864add 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/sub_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/sub_resource.py @@ -24,4 +24,5 @@ class SubResource(Model): } def __init__(self, id=None): + super(SubResource, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/subnet_association.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/subnet_association.py index 48de05bc2192..167903071a1f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/subnet_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/subnet_association.py @@ -35,5 +35,6 @@ class SubnetAssociation(Model): } def __init__(self, security_rules=None): + super(SubnetAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology.py index 8dcbe9548325..832ddf22919b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology.py @@ -44,6 +44,7 @@ class Topology(Model): } def __init__(self, resources=None): + super(Topology, self).__init__() self.id = None self.created_date_time = None self.last_modified = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_association.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_association.py index 9a114bf72c5f..0a5739195e06 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_association.py @@ -34,6 +34,7 @@ class TopologyAssociation(Model): } def __init__(self, name=None, resource_id=None, association_type=None): + super(TopologyAssociation, self).__init__() self.name = name self.resource_id = resource_id self.association_type = association_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_parameters.py index c2f674cad7fc..04920dc9665d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_parameters.py @@ -29,4 +29,5 @@ class TopologyParameters(Model): } def __init__(self, target_resource_group_name): + super(TopologyParameters, self).__init__() self.target_resource_group_name = target_resource_group_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_resource.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_resource.py index 04a5038f9fc3..b9f2d8fb25f5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/topology_resource.py @@ -35,6 +35,7 @@ class TopologyResource(Model): } def __init__(self, name=None, id=None, location=None, associations=None): + super(TopologyResource, self).__init__() self.name = name self.id = id self.location = location diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_details.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_details.py index 46b9044279b6..ef6f5487fa6e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_details.py @@ -37,6 +37,7 @@ class TroubleshootingDetails(Model): } def __init__(self, id=None, reason_type=None, summary=None, detail=None, recommended_actions=None): + super(TroubleshootingDetails, self).__init__() self.id = id self.reason_type = reason_type self.summary = summary diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_parameters.py index d6bd7ebe04e6..c4833fb8eeb3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_parameters.py @@ -38,6 +38,7 @@ class TroubleshootingParameters(Model): } def __init__(self, target_resource_id, storage_id, storage_path): + super(TroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.storage_path = storage_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_recommended_actions.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_recommended_actions.py index 479eb32b8fa8..cbc5e31177c7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_recommended_actions.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_recommended_actions.py @@ -35,6 +35,7 @@ class TroubleshootingRecommendedActions(Model): } def __init__(self, action_id=None, action_text=None, action_uri=None, action_uri_text=None): + super(TroubleshootingRecommendedActions, self).__init__() self.action_id = action_id self.action_text = action_text self.action_uri = action_uri diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_result.py index dd78d4d504d2..62625db5e184 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/troubleshooting_result.py @@ -34,6 +34,7 @@ class TroubleshootingResult(Model): } def __init__(self, start_time=None, end_time=None, code=None, results=None): + super(TroubleshootingResult, self).__init__() self.start_time = start_time self.end_time = end_time self.code = code diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/tunnel_connection_health.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/tunnel_connection_health.py index d7500fd076f0..c5fd3f94d6dd 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/tunnel_connection_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/tunnel_connection_health.py @@ -53,6 +53,7 @@ class TunnelConnectionHealth(Model): } def __init__(self): + super(TunnelConnectionHealth, self).__init__() self.tunnel = None self.connection_status = None self.ingress_bytes_transferred = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/usage.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/usage.py index 2c71eb93cf1b..48067220a610 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/usage.py @@ -46,6 +46,7 @@ class Usage(Model): unit = "Count" def __init__(self, current_value, limit, name): + super(Usage, self).__init__() self.current_value = current_value self.limit = limit self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/usage_name.py index 87786b60cf62..df7f344bfb9b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/usage_name.py @@ -27,5 +27,6 @@ class UsageName(Model): } def __init__(self, value=None, localized_value=None): + super(UsageName, self).__init__() self.value = value self.localized_value = localized_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/verification_ip_flow_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/verification_ip_flow_parameters.py index c5785ef2a488..18b4363a4f2c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/verification_ip_flow_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/verification_ip_flow_parameters.py @@ -66,6 +66,7 @@ class VerificationIPFlowParameters(Model): } def __init__(self, target_resource_id, direction, protocol, local_port, remote_port, local_ip_address, remote_ip_address, target_nic_resource_id=None): + super(VerificationIPFlowParameters, self).__init__() self.target_resource_id = target_resource_id self.direction = direction self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/verification_ip_flow_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/verification_ip_flow_result.py index 4c1533d8a3b7..246a7c1b37f2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/verification_ip_flow_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/verification_ip_flow_result.py @@ -29,5 +29,6 @@ class VerificationIPFlowResult(Model): } def __init__(self, access=None, rule_name=None): + super(VerificationIPFlowResult, self).__init__() self.access = access self.rule_name = rule_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/virtual_network_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/virtual_network_gateway_sku.py index ead6d0bcd37d..d458232bd0ab 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/virtual_network_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/virtual_network_gateway_sku.py @@ -41,6 +41,7 @@ class VirtualNetworkGatewaySku(Model): } def __init__(self, name, tier, capacity=None): + super(VirtualNetworkGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/vpn_client_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/vpn_client_configuration.py index 1c493e1bf2ed..817e1d4903cc 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/vpn_client_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/vpn_client_configuration.py @@ -36,6 +36,7 @@ class VpnClientConfiguration(Model): } def __init__(self, vpn_client_address_pool=None, vpn_client_root_certificates=None, vpn_client_revoked_certificates=None): + super(VpnClientConfiguration, self).__init__() self.vpn_client_address_pool = vpn_client_address_pool self.vpn_client_root_certificates = vpn_client_root_certificates self.vpn_client_revoked_certificates = vpn_client_revoked_certificates diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/vpn_client_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/vpn_client_parameters.py index ce3667a23ee7..3691e9bf0cc9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/vpn_client_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/vpn_client_parameters.py @@ -30,4 +30,5 @@ class VpnClientParameters(Model): } def __init__(self, processor_architecture): + super(VpnClientParameters, self).__init__() self.processor_architecture = processor_architecture diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/network_management_client.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/network_management_client.py index f520fd6a0162..d7ab67cf7142 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/network_management_client.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/network_management_client.py @@ -236,7 +236,7 @@ def check_dns_name_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/application_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/application_gateways_operations.py index 2bb80a97bfe7..3c11bf73f5f0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/application_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/application_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param parameters: Parameters supplied to the create or update - application gateway operation. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.ApplicationGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ApplicationGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ApplicationGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update + application gateway operation. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.ApplicationGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ApplicationGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('ApplicationGateway', response) + deserialized = self._deserialize('ApplicationGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -381,7 +431,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -400,23 +450,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def start( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Starts the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _start_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start' path_format_arguments = { @@ -441,18 +477,58 @@ def start( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 start( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Starts the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._start_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -465,10 +541,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -476,23 +548,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Stops the specified application gateway in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop' path_format_arguments = { @@ -517,18 +575,58 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def stop( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Stops the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -541,10 +639,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -552,28 +646,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def backend_health( - self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Gets the backend health of the specified application gateway in a - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param expand: Expands BackendAddressPool and BackendHttpSettings - referenced in backend health. - :type expand: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGatewayBackendHealth or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ApplicationGatewayBackendHealth] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _backend_health_initial( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth' path_format_arguments = { @@ -600,18 +675,71 @@ def backend_health( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ApplicationGatewayBackendHealth', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def backend_health( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets the backend health of the specified application gateway in a + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param expand: Expands BackendAddressPool and BackendHttpSettings + referenced in backend health. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGatewayBackendHealth or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ApplicationGatewayBackendHealth] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._backend_health_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + expand=expand, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -620,10 +748,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) + deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -631,10 +756,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuit_authorizations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuit_authorizations_operations.py index c269bf00d802..2d5f0502637c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuit_authorizations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuit_authorizations_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified authorization from the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified authorization from the specified express route + circuit. - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,31 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an authorization in the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param authorization_parameters: Parameters supplied to the create or - update express route circuit authorization operation. - :type authorization_parameters: - ~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitAuthorization - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitAuthorization] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -238,19 +240,78 @@ def create_or_update( body_content = self._serialize.body(authorization_parameters, 'ExpressRouteCircuitAuthorization') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization in the specified express route + circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or + update express route circuit authorization operation. + :type authorization_parameters: + ~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitAuthorization + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitAuthorization] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + authorization_parameters=authorization_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -259,12 +320,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -272,10 +328,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuit_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuit_peerings_operations.py index fb89aa92a9f6..1bed3a43e3b5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuit_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuit_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified peering from the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified peering from the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified express route circuits. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param peering_parameters: Parameters supplied to the create or update - express route circuit peering operation. - :type peering_parameters: - ~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(peering_parameters, 'ExpressRouteCircuitPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + express route circuit peering operation. + :type peering_parameters: + ~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + peering_parameters=peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuits_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuits_operations.py index 6f135d0bd0aa..9bd1e8091965 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuits_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_circuits_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the circuit. - :type circuit_name: str - :param parameters: Parameters supplied to the create or update express - route circuit operation. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuit - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuit or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuit] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ExpressRouteCircuit') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuit', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuit', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the circuit. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express + route circuit operation. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuit + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuit or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuit] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuit', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuit', response) + deserialized = self._deserialize('ExpressRouteCircuit', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -269,30 +319,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_arp_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised ARP table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsArpTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitsArpTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_arp_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}' path_format_arguments = { @@ -319,18 +348,74 @@ def list_arp_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ExpressRouteCircuitsArpTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_arp_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised ARP table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsArpTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitsArpTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_arp_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -339,10 +424,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -350,10 +432,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -361,30 +439,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitsRoutesTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}' path_format_arguments = { @@ -411,18 +468,74 @@ def list_routes_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsRoutesTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitsRoutesTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -431,10 +544,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -442,10 +552,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -453,30 +559,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table_summary( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table summary associated with the - express route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse - if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_summary_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}' path_format_arguments = { @@ -503,18 +588,74 @@ def list_routes_table_summary( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table_summary( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table summary associated with the + express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse + if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -523,10 +664,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -534,10 +672,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -589,7 +723,7 @@ def get_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -654,7 +788,7 @@ def get_peering_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -720,7 +854,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -784,7 +918,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_service_providers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_service_providers_operations.py index 86dcb06ebb59..6798649a9c29 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_service_providers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/express_route_service_providers_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/load_balancers_operations.py index 2d1ad4c7143e..d9428ec724f8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/load_balancers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param parameters: Parameters supplied to the create or update load - balancer operation. - :type parameters: ~azure.mgmt.network.v2016_09_01.models.LoadBalancer - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns LoadBalancer - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.LoadBalancer] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LoadBalancer') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LoadBalancer', response) + if response.status_code == 201: + deserialized = self._deserialize('LoadBalancer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load + balancer operation. + :type parameters: ~azure.mgmt.network.v2016_09_01.models.LoadBalancer + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns LoadBalancer + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.LoadBalancer] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LoadBalancer', response) - if response.status_code == 201: - deserialized = self._deserialize('LoadBalancer', response) + deserialized = self._deserialize('LoadBalancer', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/local_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/local_network_gateways_operations.py index b1b52b962fc2..a520208b2a81 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/local_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/local_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a local network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param parameters: Parameters supplied to the create or update local - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.LocalNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - LocalNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.LocalNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LocalNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocalNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('LocalNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a local network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.LocalNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + LocalNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.LocalNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LocalNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('LocalNetworkGateway', response) + deserialized = self._deserialize('LocalNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified local network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified local network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_interfaces_operations.py index b9a1a1cf85f4..40180720be2f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_interfaces_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -94,7 +95,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -165,7 +166,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -238,7 +239,7 @@ def get_virtual_machine_scale_set_network_interface( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -256,23 +257,9 @@ def get_virtual_machine_scale_set_network_interface( return deserialized - def delete( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}' path_format_arguments = { @@ -297,18 +284,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -321,10 +348,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -379,7 +402,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -397,28 +420,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param parameters: Parameters supplied to the create or update network - interface operation. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.NetworkInterface - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkInterface or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.NetworkInterface] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}' path_format_arguments = { @@ -446,19 +450,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkInterface') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkInterface', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkInterface', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network + interface operation. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.NetworkInterface + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkInterface or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.NetworkInterface] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -467,12 +526,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkInterface', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkInterface', response) + deserialized = self._deserialize('NetworkInterface', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -480,10 +534,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -536,7 +586,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -603,7 +653,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -622,24 +672,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def get_effective_route_table( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all route tables applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.EffectiveRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_effective_route_table_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable' path_format_arguments = { @@ -664,18 +699,66 @@ def get_effective_route_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_effective_route_table( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all route tables applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.EffectiveRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_effective_route_table_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -684,10 +767,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveRouteListResult', response) + deserialized = self._deserialize('EffectiveRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -695,10 +775,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -706,25 +782,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_effective_network_security_groups( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all network security groups applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveNetworkSecurityGroupListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.EffectiveNetworkSecurityGroupListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_effective_network_security_groups_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups' path_format_arguments = { @@ -749,18 +809,67 @@ def list_effective_network_security_groups( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveNetworkSecurityGroupListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_effective_network_security_groups( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all network security groups applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveNetworkSecurityGroupListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.EffectiveNetworkSecurityGroupListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_effective_network_security_groups_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -769,10 +878,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) + deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -780,10 +886,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_security_groups_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_security_groups_operations.py index 6cf36a1f8285..07f3c4f3e039 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_security_groups_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_security_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,24 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -80,18 +66,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def delete( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -104,10 +131,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network security group in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param parameters: Parameters supplied to the create or update network - security group operation. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.NetworkSecurityGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.NetworkSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -232,19 +234,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkSecurityGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network security group in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network + security group operation. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.NetworkSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.NetworkSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkSecurityGroup', response) + deserialized = self._deserialize('NetworkSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -322,7 +372,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -389,7 +439,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_watchers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_watchers_operations.py index cf87bfafdcff..59aefe69d03a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_watchers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/network_watchers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -152,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -170,23 +171,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network watcher resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}' path_format_arguments = { @@ -211,18 +198,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network watcher resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -235,10 +262,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -294,7 +317,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -358,7 +381,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -429,7 +452,7 @@ def get_topology( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -447,28 +470,9 @@ def get_topology( return deserialized - def verify_ip_flow( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Verify IP flow from the specified VM to a location given the currently - configured NSG rules. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the IP flow to be verified. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.VerificationIPFlowParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VerificationIPFlowResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VerificationIPFlowResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _verify_ip_flow_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify' path_format_arguments = { @@ -496,19 +500,74 @@ def verify_ip_flow( body_content = self._serialize.body(parameters, 'VerificationIPFlowParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('VerificationIPFlowResult', response) + if response.status_code == 202: + deserialized = self._deserialize('VerificationIPFlowResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def verify_ip_flow( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Verify IP flow from the specified VM to a location given the currently + configured NSG rules. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.VerificationIPFlowParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VerificationIPFlowResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VerificationIPFlowResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._verify_ip_flow_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -517,12 +576,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VerificationIPFlowResult', response) - if response.status_code == 202: - deserialized = self._deserialize('VerificationIPFlowResult', response) + deserialized = self._deserialize('VerificationIPFlowResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -530,10 +584,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -541,28 +591,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_next_hop( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Gets the next hop from the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the source and destination - endpoint. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.NextHopParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NextHopResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.NextHopResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_next_hop_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop' path_format_arguments = { @@ -590,19 +621,74 @@ def get_next_hop( body_content = self._serialize.body(parameters, 'NextHopParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('NextHopResult', response) + if response.status_code == 202: + deserialized = self._deserialize('NextHopResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_next_hop( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination + endpoint. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.NextHopParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NextHopResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.NextHopResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_next_hop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -611,12 +697,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NextHopResult', response) - if response.status_code == 202: - deserialized = self._deserialize('NextHopResult', response) + deserialized = self._deserialize('NextHopResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -624,10 +705,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -635,27 +712,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_vm_security_rules( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Gets the configured and effective security group rules on the specified - VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param target_resource_id: ID of the target VM. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - SecurityGroupViewResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.SecurityGroupViewResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_vm_security_rules_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.SecurityGroupViewParameters(target_resource_id=target_resource_id) # Construct URL @@ -685,19 +744,73 @@ def get_vm_security_rules( body_content = self._serialize.body(parameters, 'SecurityGroupViewParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('SecurityGroupViewResult', response) + if response.status_code == 202: + deserialized = self._deserialize('SecurityGroupViewResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_vm_security_rules( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the configured and effective security group rules on the specified + VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param target_resource_id: ID of the target VM. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + SecurityGroupViewResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.SecurityGroupViewResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_vm_security_rules_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -706,12 +819,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityGroupViewResult', response) - if response.status_code == 202: - deserialized = self._deserialize('SecurityGroupViewResult', response) + deserialized = self._deserialize('SecurityGroupViewResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -719,10 +827,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -730,28 +834,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Initiate troubleshooting on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the resource to - troubleshoot. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.TroubleshootingParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot' path_format_arguments = { @@ -779,19 +864,74 @@ def get_troubleshooting( body_content = self._serialize.body(parameters, 'TroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to + troubleshoot. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.TroubleshootingParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -800,12 +940,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -813,10 +948,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -824,27 +955,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting_result( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Get the last completed troubleshooting result on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource ID to query the - troubleshooting result. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_result_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.QueryTroubleshootingParameters(target_resource_id=target_resource_id) # Construct URL @@ -874,19 +987,73 @@ def get_troubleshooting_result( body_content = self._serialize.body(parameters, 'QueryTroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting_result( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource ID to query the + troubleshooting result. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_result_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -895,12 +1062,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -908,10 +1070,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -919,29 +1077,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_flow_log_configuration( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Configures flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the configuration of flow - log. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.FlowLogInformation - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_flow_log_configuration_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog' path_format_arguments = { @@ -969,19 +1107,75 @@ def set_flow_log_configuration( body_content = self._serialize.body(parameters, 'FlowLogInformation') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_flow_log_configuration( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Configures flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow + log. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.FlowLogInformation + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_flow_log_configuration_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -990,12 +1184,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1003,10 +1192,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1014,28 +1199,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_flow_log_status( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Queries status of flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource where getting the flow - logging status. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_flow_log_status_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.FlowLogStatusParameters(target_resource_id=target_resource_id) # Construct URL @@ -1065,19 +1231,74 @@ def get_flow_log_status( body_content = self._serialize.body(parameters, 'FlowLogStatusParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_flow_log_status( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Queries status of flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource where getting the flow + logging status. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_flow_log_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1086,12 +1307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1099,10 +1315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/packet_captures_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/packet_captures_operations.py index 75335c6c5f01..50840abcb46e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/packet_captures_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/packet_captures_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,29 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create( - self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create and start a packet capture on the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param parameters: Parameters that define the create packet capture - operation. - :type parameters: ~azure.mgmt.network.v2016_09_01.models.PacketCapture - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.PacketCaptureResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -89,19 +70,74 @@ def create( body_content = self._serialize.body(parameters, 'PacketCapture') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('PacketCaptureResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture + operation. + :type parameters: ~azure.mgmt.network.v2016_09_01.models.PacketCapture + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.PacketCaptureResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,10 +146,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('PacketCaptureResult', response) + deserialized = self._deserialize('PacketCaptureResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -121,10 +154,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +207,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,25 +225,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -240,18 +253,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -264,10 +320,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -275,25 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Stops a specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop' path_format_arguments = { @@ -319,18 +355,61 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 stop( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Stops a specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +422,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -354,27 +429,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_status( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Query the status of a running packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the Network Watcher resource. - :type network_watcher_name: str - :param packet_capture_name: The name given to the packet capture - session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureQueryStatusResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.PacketCaptureQueryStatusResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_status_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus' path_format_arguments = { @@ -400,18 +457,72 @@ def get_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('PacketCaptureQueryStatusResult', response) + if response.status_code == 202: + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_status( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Query the status of a running packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param packet_capture_name: The name given to the packet capture + session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureQueryStatusResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.PacketCaptureQueryStatusResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -420,12 +531,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) - if response.status_code == 202: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -433,10 +539,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -495,7 +597,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/public_ip_addresses_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/public_ip_addresses_operations.py index 47fe371f918d..0a68d94fa467 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/public_ip_addresses_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/public_ip_addresses_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the subnet. - :type public_ip_address_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the subnet. + :type public_ip_address_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a static or dynamic public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the public IP address. - :type public_ip_address_name: str - :param parameters: Parameters supplied to the create or update public - IP address operation. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.PublicIPAddress - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PublicIPAddress or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.PublicIPAddress] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'PublicIPAddress') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PublicIPAddress', response) + if response.status_code == 201: + deserialized = self._deserialize('PublicIPAddress', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public + IP address operation. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.PublicIPAddress + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PublicIPAddress or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.PublicIPAddress] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PublicIPAddress', response) - if response.status_code == 201: - deserialized = self._deserialize('PublicIPAddress', response) + deserialized = self._deserialize('PublicIPAddress', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/route_tables_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/route_tables_operations.py index 43918503552a..12f6b4890960 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/route_tables_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/route_tables_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create or updates a route table in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param parameters: Parameters supplied to the create or update route - table operation. - :type parameters: ~azure.mgmt.network.v2016_09_01.models.RouteTable - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteTable - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.RouteTable] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'RouteTable') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteTable', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route + table operation. + :type parameters: ~azure.mgmt.network.v2016_09_01.models.RouteTable + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteTable + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.RouteTable] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteTable', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteTable', response) + deserialized = self._deserialize('RouteTable', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -320,7 +370,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/routes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/routes_operations.py index 2227fe1dd285..5cd4192ad1e8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/routes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/routes_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route from a route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route from a route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,29 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param route_parameters: Parameters supplied to the create or update - route operation. - :type route_parameters: ~azure.mgmt.network.v2016_09_01.models.Route - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Route or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.Route] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -232,19 +236,76 @@ def create_or_update( body_content = self._serialize.body(route_parameters, 'Route') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Route', response) + if response.status_code == 201: + deserialized = self._deserialize('Route', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update + route operation. + :type route_parameters: ~azure.mgmt.network.v2016_09_01.models.Route + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Route or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.Route] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + route_parameters=route_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +314,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Route', response) - if response.status_code == 201: - deserialized = self._deserialize('Route', response) + deserialized = self._deserialize('Route', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +322,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -328,7 +380,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/security_rules_operations.py index c712b5e0bf71..a76c167a4788 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/security_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,32 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a security rule in the specified network security - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param security_rule_parameters: Parameters supplied to the create or - update network security rule operation. - :type security_rule_parameters: - ~azure.mgmt.network.v2016_09_01.models.SecurityRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns SecurityRule - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.SecurityRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -237,19 +238,79 @@ def create_or_update( body_content = self._serialize.body(security_rule_parameters, 'SecurityRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SecurityRule', response) + if response.status_code == 201: + deserialized = self._deserialize('SecurityRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a security rule in the specified network security + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or + update network security rule operation. + :type security_rule_parameters: + ~azure.mgmt.network.v2016_09_01.models.SecurityRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns SecurityRule + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.SecurityRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + security_rule_parameters=security_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -258,12 +319,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityRule', response) - if response.status_code == 201: - deserialized = self._deserialize('SecurityRule', response) + deserialized = self._deserialize('SecurityRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -271,10 +327,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/subnets_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/subnets_operations.py index 5f0d5b9b3261..b8922554afc9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/subnets_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/subnets_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified subnet. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified subnet. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,29 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a subnet in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param subnet_parameters: Parameters supplied to the create or update - subnet operation. - :type subnet_parameters: ~azure.mgmt.network.v2016_09_01.models.Subnet - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Subnet or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.Subnet] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -236,19 +240,76 @@ def create_or_update( body_content = self._serialize.body(subnet_parameters, 'Subnet') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Subnet', response) + if response.status_code == 201: + deserialized = self._deserialize('Subnet', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update + subnet operation. + :type subnet_parameters: ~azure.mgmt.network.v2016_09_01.models.Subnet + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Subnet or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.Subnet] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subnet_parameters=subnet_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -257,12 +318,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Subnet', response) - if response.status_code == 201: - deserialized = self._deserialize('Subnet', response) + deserialized = self._deserialize('Subnet', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -270,10 +326,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -332,7 +384,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/usages_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/usages_operations.py index 6d8b0307945c..df00ab57578c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/usages_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/usages_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_gateway_connections_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_gateway_connections_operations.py index b87ea3aa1ee7..eaad1a73283e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_gateway_connections_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_gateway_connections_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway connection in the - specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param parameters: Parameters supplied to the create or update virtual - network gateway connection operation. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.VirtualNetworkGatewayConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGatewayConnection or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VirtualNetworkGatewayConnection] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGatewayConnection') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway connection in the + specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual + network gateway connection operation. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.VirtualNetworkGatewayConnection + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGatewayConnection or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VirtualNetworkGatewayConnection] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -181,7 +209,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -199,24 +227,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network Gateway connection. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -241,18 +254,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network Gateway connection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -265,10 +319,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -276,30 +326,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): - """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection name. - :type virtual_network_gateway_connection_name: str - :param value: The virtual network connection shared key value. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ConnectionSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionSharedKey(value=value) # Construct URL @@ -329,19 +358,76 @@ def set_shared_key( body_content = self._serialize.body(parameters, 'ConnectionSharedKey') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConnectionSharedKey', response) + if response.status_code == 201: + deserialized = self._deserialize('ConnectionSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection name. + :type virtual_network_gateway_connection_name: str + :param value: The virtual network connection shared key value. + :type value: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ConnectionSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + value=value, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -350,12 +436,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionSharedKey', response) - if response.status_code == 201: - deserialized = self._deserialize('ConnectionSharedKey', response) + deserialized = self._deserialize('ConnectionSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -363,10 +444,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -420,7 +497,7 @@ def get_shared_key( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -487,7 +564,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -506,31 +583,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): - """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection reset shared key Name. - :type virtual_network_gateway_connection_name: str - :param key_length: The virtual network connection reset shared key - length, should between 1 and 128. - :type key_length: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionResetSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ConnectionResetSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionResetSharedKey(key_length=key_length) # Construct URL @@ -560,19 +615,75 @@ def reset_shared_key( body_content = self._serialize.body(parameters, 'ConnectionResetSharedKey') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectionResetSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection reset shared key Name. + :type virtual_network_gateway_connection_name: str + :param key_length: The virtual network connection reset shared key + length, should between 1 and 128. + :type key_length: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionResetSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.ConnectionResetSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + key_length=key_length, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -581,10 +692,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionResetSharedKey', response) + deserialized = self._deserialize('ConnectionResetSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -592,10 +700,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_gateways_operations.py index f9d7e86a3c9a..af4cbf5ce252 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to create or update virtual - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.VirtualNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.VirtualNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -340,29 +390,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset( - self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): - """Resets the primary of the virtual network gateway in the specified - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param gateway_vip: Virtual network gateway vip address supplied to - the begin reset of the active-active feature enabled gateway. - :type gateway_vip: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_initial( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset' path_format_arguments = { @@ -389,18 +419,72 @@ def reset( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): + """Resets the primary of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param gateway_vip: Virtual network gateway vip address supplied to + the begin reset of the active-active feature enabled gateway. + :type gateway_vip: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + gateway_vip=gateway_vip, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -409,10 +493,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -420,10 +501,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -486,7 +563,7 @@ def generatevpnclientpackage( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [202]: exp = CloudError(response) @@ -504,27 +581,9 @@ def generatevpnclientpackage( return deserialized - def get_bgp_peer_status( - self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): - """The GetBgpPeerStatus operation retrieves the status of all BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer to retrieve the status of. - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - BgpPeerStatusListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.BgpPeerStatusListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_bgp_peer_status_initial( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus' path_format_arguments = { @@ -551,18 +610,70 @@ def get_bgp_peer_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BgpPeerStatusListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_bgp_peer_status( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): + """The GetBgpPeerStatus operation retrieves the status of all BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer to retrieve the status of. + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + BgpPeerStatusListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.BgpPeerStatusListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_bgp_peer_status_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -571,10 +682,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BgpPeerStatusListResult', response) + deserialized = self._deserialize('BgpPeerStatusListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -582,10 +690,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -593,26 +697,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_learned_routes( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - has learned, including routes learned from BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_learned_routes_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes' path_format_arguments = { @@ -637,18 +724,68 @@ def get_learned_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_learned_routes( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + has learned, including routes learned from BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_learned_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -657,10 +794,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -668,10 +802,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -679,28 +809,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_advertised_routes( - self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - is advertising to the specified peer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_advertised_routes_initial( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes' path_format_arguments = { @@ -726,18 +837,71 @@ def get_advertised_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_advertised_routes( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + is advertising to the specified peer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_advertised_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -746,10 +910,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -757,10 +918,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_peerings_operations.py index 5ea35bf195b4..60de133a7c01 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_network_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network peering. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the virtual network - peering. - :type virtual_network_peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network + peering. + :type virtual_network_peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the peering. - :type virtual_network_peering_name: str - :param virtual_network_peering_parameters: Parameters supplied to the - create or update virtual network peering operation. - :type virtual_network_peering_parameters: - ~azure.mgmt.network.v2016_09_01.models.VirtualNetworkPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VirtualNetworkPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(virtual_network_peering_parameters, 'VirtualNetworkPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the + create or update virtual network peering operation. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2016_09_01.models.VirtualNetworkPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VirtualNetworkPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + virtual_network_peering_parameters=virtual_network_peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkPeering', response) + deserialized = self._deserialize('VirtualNetworkPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_networks_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_networks_operations.py index 7aec6cfa794e..f11ea9d0cd96 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_networks_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/virtual_networks_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network in the specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to the create or update virtual - network operation - :type parameters: - ~azure.mgmt.network.v2016_09_01.models.VirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetwork or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VirtualNetwork] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetwork') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetwork', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual + network operation + :type parameters: + ~azure.mgmt.network.v2016_09_01.models.VirtualNetwork + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetwork or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_09_01.models.VirtualNetwork] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetwork', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetwork', response) + deserialized = self._deserialize('VirtualNetwork', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -452,7 +502,7 @@ def check_ip_address_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/address_space.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/address_space.py index 4ff6fb3af6d8..d7050c78a457 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/address_space.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/address_space.py @@ -26,4 +26,5 @@ class AddressSpace(Model): } def __init__(self, address_prefixes=None): + super(AddressSpace, self).__init__() self.address_prefixes = address_prefixes diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_address.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_address.py index 5ff5ce4b4a5c..6005027d0845 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_address.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_address.py @@ -27,5 +27,6 @@ class ApplicationGatewayBackendAddress(Model): } def __init__(self, fqdn=None, ip_address=None): + super(ApplicationGatewayBackendAddress, self).__init__() self.fqdn = fqdn self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health.py index cb6a9dd81a54..ba16d1e0414f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health.py @@ -25,4 +25,5 @@ class ApplicationGatewayBackendHealth(Model): } def __init__(self, backend_address_pools=None): + super(ApplicationGatewayBackendHealth, self).__init__() self.backend_address_pools = backend_address_pools diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_http_settings.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_http_settings.py index d7767d722360..d55db78f5faf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_http_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_http_settings.py @@ -30,5 +30,6 @@ class ApplicationGatewayBackendHealthHttpSettings(Model): } def __init__(self, backend_http_settings=None, servers=None): + super(ApplicationGatewayBackendHealthHttpSettings, self).__init__() self.backend_http_settings = backend_http_settings self.servers = servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_pool.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_pool.py index 2e46c8facc10..3d5126c672f9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_pool.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_pool.py @@ -31,5 +31,6 @@ class ApplicationGatewayBackendHealthPool(Model): } def __init__(self, backend_address_pool=None, backend_http_settings_collection=None): + super(ApplicationGatewayBackendHealthPool, self).__init__() self.backend_address_pool = backend_address_pool self.backend_http_settings_collection = backend_http_settings_collection diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_server.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_server.py index 2bea74db5283..6173dd233d57 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_server.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_backend_health_server.py @@ -33,6 +33,7 @@ class ApplicationGatewayBackendHealthServer(Model): } def __init__(self, address=None, ip_configuration=None, health=None): + super(ApplicationGatewayBackendHealthServer, self).__init__() self.address = address self.ip_configuration = ip_configuration self.health = health diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_connection_draining.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_connection_draining.py index e1912ca67c62..8f9b88b571e2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_connection_draining.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_connection_draining.py @@ -35,5 +35,6 @@ class ApplicationGatewayConnectionDraining(Model): } def __init__(self, enabled, drain_timeout_in_sec): + super(ApplicationGatewayConnectionDraining, self).__init__() self.enabled = enabled self.drain_timeout_in_sec = drain_timeout_in_sec diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_sku.py index 89b01bcaf8df..c902412327b8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_sku.py @@ -36,6 +36,7 @@ class ApplicationGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(ApplicationGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_ssl_policy.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_ssl_policy.py index 51909c57cfc3..f5109cc64c31 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_ssl_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_ssl_policy.py @@ -26,4 +26,5 @@ class ApplicationGatewaySslPolicy(Model): } def __init__(self, disabled_ssl_protocols=None): + super(ApplicationGatewaySslPolicy, self).__init__() self.disabled_ssl_protocols = disabled_ssl_protocols diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_web_application_firewall_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_web_application_firewall_configuration.py index 7c7a339368f1..67920fde18bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_web_application_firewall_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/application_gateway_web_application_firewall_configuration.py @@ -34,5 +34,6 @@ class ApplicationGatewayWebApplicationFirewallConfiguration(Model): } def __init__(self, enabled, firewall_mode=None): + super(ApplicationGatewayWebApplicationFirewallConfiguration, self).__init__() self.enabled = enabled self.firewall_mode = firewall_mode diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/azure_async_operation_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/azure_async_operation_result.py index 6aca589f8fae..d5eb8785314d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/azure_async_operation_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/azure_async_operation_result.py @@ -37,5 +37,6 @@ class AzureAsyncOperationResult(Model): } def __init__(self, status=None, error=None): + super(AzureAsyncOperationResult, self).__init__() self.status = status self.error = error diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_community.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_community.py index 197235cc5e9e..a2162c1ecfec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_community.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_community.py @@ -36,6 +36,7 @@ class BGPCommunity(Model): } def __init__(self, service_supported_region=None, community_name=None, community_value=None, community_prefixes=None): + super(BGPCommunity, self).__init__() self.service_supported_region = service_supported_region self.community_name = community_name self.community_value = community_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_peer_status.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_peer_status.py index 6c3aa3dcc960..edcdaa35ccae 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_peer_status.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_peer_status.py @@ -60,6 +60,7 @@ class BgpPeerStatus(Model): } def __init__(self): + super(BgpPeerStatus, self).__init__() self.local_address = None self.neighbor = None self.asn = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_peer_status_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_peer_status_list_result.py index 1eca9c9e2e91..51c9e30f402f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_peer_status_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_peer_status_list_result.py @@ -24,4 +24,5 @@ class BgpPeerStatusListResult(Model): } def __init__(self, value=None): + super(BgpPeerStatusListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_settings.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_settings.py index b64d10a21139..cd3f5e596a04 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/bgp_settings.py @@ -32,6 +32,7 @@ class BgpSettings(Model): } def __init__(self, asn=None, bgp_peering_address=None, peer_weight=None): + super(BgpSettings, self).__init__() self.asn = asn self.bgp_peering_address = bgp_peering_address self.peer_weight = peer_weight diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/connection_reset_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/connection_reset_shared_key.py index 43eff397461d..c68ade7d79f5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/connection_reset_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/connection_reset_shared_key.py @@ -29,4 +29,5 @@ class ConnectionResetSharedKey(Model): } def __init__(self, key_length): + super(ConnectionResetSharedKey, self).__init__() self.key_length = key_length diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/connection_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/connection_shared_key.py index 0dbbc36cc798..2c1b0ed9a914 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/connection_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/connection_shared_key.py @@ -28,4 +28,5 @@ class ConnectionSharedKey(Model): } def __init__(self, value): + super(ConnectionSharedKey, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/dhcp_options.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/dhcp_options.py index 2262eb5ec2f1..8744ba6fc9b1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/dhcp_options.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/dhcp_options.py @@ -26,4 +26,5 @@ class DhcpOptions(Model): } def __init__(self, dns_servers=None): + super(DhcpOptions, self).__init__() self.dns_servers = dns_servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/dns_name_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/dns_name_availability_result.py index 4be1851d2f59..15a0238e49a7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/dns_name_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/dns_name_availability_result.py @@ -24,4 +24,5 @@ class DnsNameAvailabilityResult(Model): } def __init__(self, available=None): + super(DnsNameAvailabilityResult, self).__init__() self.available = available diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group.py index 9e0be0544c2e..7d6c1c186e45 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group.py @@ -34,6 +34,7 @@ class EffectiveNetworkSecurityGroup(Model): } def __init__(self, network_security_group=None, association=None, effective_security_rules=None): + super(EffectiveNetworkSecurityGroup, self).__init__() self.network_security_group = network_security_group self.association = association self.effective_security_rules = effective_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group_association.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group_association.py index 4807b79aeeec..a54215cae7bf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group_association.py @@ -28,5 +28,6 @@ class EffectiveNetworkSecurityGroupAssociation(Model): } def __init__(self, subnet=None, network_interface=None): + super(EffectiveNetworkSecurityGroupAssociation, self).__init__() self.subnet = subnet self.network_interface = network_interface diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group_list_result.py index 0a72ce412cf5..dbd1fa411beb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_group_list_result.py @@ -28,5 +28,6 @@ class EffectiveNetworkSecurityGroupListResult(Model): } def __init__(self, value=None, next_link=None): + super(EffectiveNetworkSecurityGroupListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_rule.py index 449986b97417..162a33447e2e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_network_security_rule.py @@ -63,6 +63,7 @@ class EffectiveNetworkSecurityRule(Model): } def __init__(self, name=None, protocol=None, source_port_range=None, destination_port_range=None, source_address_prefix=None, destination_address_prefix=None, expanded_source_address_prefix=None, expanded_destination_address_prefix=None, access=None, priority=None, direction=None): + super(EffectiveNetworkSecurityRule, self).__init__() self.name = name self.protocol = protocol self.source_port_range = source_port_range diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_route.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_route.py index 3e87f5765d98..6cfb1224f733 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_route.py @@ -51,6 +51,7 @@ class EffectiveRoute(Model): } def __init__(self, name=None, source=None, state=None, address_prefix=None, next_hop_ip_address=None, next_hop_type=None): + super(EffectiveRoute, self).__init__() self.name = name self.source = source self.state = state diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_route_list_result.py index 1bbcf5b49411..c581ad0b6117 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/effective_route_list_result.py @@ -27,5 +27,6 @@ class EffectiveRouteListResult(Model): } def __init__(self, value=None, next_link=None): + super(EffectiveRouteListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/error.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/error.py index c82c25de387e..ed2dda4627c5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/error.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/error.py @@ -36,6 +36,7 @@ class Error(Model): } def __init__(self, code=None, message=None, target=None, details=None, inner_error=None): + super(Error, self).__init__() self.code = code self.message = message self.target = target diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/error_details.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/error_details.py index 47f2ac4111b1..40bea00aa2fb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/error_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/error_details.py @@ -30,6 +30,7 @@ class ErrorDetails(Model): } def __init__(self, code=None, target=None, message=None): + super(ErrorDetails, self).__init__() self.code = code self.target = target self.message = message diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_arp_table.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_arp_table.py index a2f8f716bf8a..ace325747ee5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_arp_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_arp_table.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitArpTable(Model): } def __init__(self, age=None, interface=None, ip_address=None, mac_address=None): + super(ExpressRouteCircuitArpTable, self).__init__() self.age = age self.interface = interface self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_peering_config.py index 33e8ec746524..e5a980202a4d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_peering_config.py @@ -39,6 +39,7 @@ class ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, advertised_public_prefixes=None, advertised_public_prefixes_state=None, customer_asn=None, routing_registry_name=None): + super(ExpressRouteCircuitPeeringConfig, self).__init__() self.advertised_public_prefixes = advertised_public_prefixes self.advertised_public_prefixes_state = advertised_public_prefixes_state self.customer_asn = customer_asn diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_routes_table.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_routes_table.py index e84fae6e0973..804d29a2f9bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_routes_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_routes_table.py @@ -36,6 +36,7 @@ class ExpressRouteCircuitRoutesTable(Model): } def __init__(self, network=None, next_hop=None, loc_prf=None, weight=None, path=None): + super(ExpressRouteCircuitRoutesTable, self).__init__() self.network = network self.next_hop = next_hop self.loc_prf = loc_prf diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_routes_table_summary.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_routes_table_summary.py index 3ff1b42d0c1b..6f5f89764dd4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_routes_table_summary.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_routes_table_summary.py @@ -38,6 +38,7 @@ class ExpressRouteCircuitRoutesTableSummary(Model): } def __init__(self, neighbor=None, v=None, as_property=None, up_down=None, state_pfx_rcd=None): + super(ExpressRouteCircuitRoutesTableSummary, self).__init__() self.neighbor = neighbor self.v = v self.as_property = as_property diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_service_provider_properties.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_service_provider_properties.py index b7ada851e235..7a6b4ba96061 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_service_provider_properties.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_service_provider_properties.py @@ -30,6 +30,7 @@ class ExpressRouteCircuitServiceProviderProperties(Model): } def __init__(self, service_provider_name=None, peering_location=None, bandwidth_in_mbps=None): + super(ExpressRouteCircuitServiceProviderProperties, self).__init__() self.service_provider_name = service_provider_name self.peering_location = peering_location self.bandwidth_in_mbps = bandwidth_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_sku.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_sku.py index c698b71dfdb7..27ce0b6a17eb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_sku.py @@ -34,6 +34,7 @@ class ExpressRouteCircuitSku(Model): } def __init__(self, name=None, tier=None, family=None): + super(ExpressRouteCircuitSku, self).__init__() self.name = name self.tier = tier self.family = family diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_stats.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_stats.py index 1215bda40383..e26f6f7d2f74 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_stats.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuit_stats.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitStats(Model): } def __init__(self, primarybytes_in=None, primarybytes_out=None, secondarybytes_in=None, secondarybytes_out=None): + super(ExpressRouteCircuitStats, self).__init__() self.primarybytes_in = primarybytes_in self.primarybytes_out = primarybytes_out self.secondarybytes_in = secondarybytes_in diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_arp_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_arp_table_list_result.py index 1b0381459e12..5254157f1744 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_arp_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_arp_table_list_result.py @@ -28,5 +28,6 @@ class ExpressRouteCircuitsArpTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsArpTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_routes_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_routes_table_list_result.py index 5f945b5a2824..029cc8337a0d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_routes_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_routes_table_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_routes_table_summary_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_routes_table_summary_list_result.py index fe06383ec109..fc5e57caa4c0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_routes_table_summary_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_circuits_routes_table_summary_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableSummaryListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableSummaryListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_service_provider_bandwidths_offered.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_service_provider_bandwidths_offered.py index b1b2c8a76447..9cbba2fcfe97 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_service_provider_bandwidths_offered.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/express_route_service_provider_bandwidths_offered.py @@ -27,5 +27,6 @@ class ExpressRouteServiceProviderBandwidthsOffered(Model): } def __init__(self, offer_name=None, value_in_mbps=None): + super(ExpressRouteServiceProviderBandwidthsOffered, self).__init__() self.offer_name = offer_name self.value_in_mbps = value_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/flow_log_information.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/flow_log_information.py index 719c2d3004f2..a6f70e598a6f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/flow_log_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/flow_log_information.py @@ -42,6 +42,7 @@ class FlowLogInformation(Model): } def __init__(self, target_resource_id, storage_id, enabled, retention_policy=None): + super(FlowLogInformation, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/flow_log_status_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/flow_log_status_parameters.py index 1dae2ff24447..4cd22222bb45 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/flow_log_status_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/flow_log_status_parameters.py @@ -29,4 +29,5 @@ class FlowLogStatusParameters(Model): } def __init__(self, target_resource_id): + super(FlowLogStatusParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/gateway_route.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/gateway_route.py index d62839bba217..b4e542466325 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/gateway_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/gateway_route.py @@ -55,6 +55,7 @@ class GatewayRoute(Model): } def __init__(self): + super(GatewayRoute, self).__init__() self.local_address = None self.network = None self.next_hop = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/gateway_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/gateway_route_list_result.py index 6d02a3cd512d..3385aaffc672 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/gateway_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/gateway_route_list_result.py @@ -24,4 +24,5 @@ class GatewayRouteListResult(Model): } def __init__(self, value=None): + super(GatewayRouteListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/ip_address_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/ip_address_availability_result.py index 0e26dd91fffc..f2cb36a550ec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/ip_address_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/ip_address_availability_result.py @@ -28,5 +28,6 @@ class IPAddressAvailabilityResult(Model): } def __init__(self, available=None, available_ip_addresses=None): + super(IPAddressAvailabilityResult, self).__init__() self.available = available self.available_ip_addresses = available_ip_addresses diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/network_interface_association.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/network_interface_association.py index 534a00f72993..c6f51377d0f8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/network_interface_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/network_interface_association.py @@ -35,5 +35,6 @@ class NetworkInterfaceAssociation(Model): } def __init__(self, security_rules=None): + super(NetworkInterfaceAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/network_interface_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/network_interface_dns_settings.py index 110594c2f928..675a4a1eb08a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/network_interface_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/network_interface_dns_settings.py @@ -47,6 +47,7 @@ class NetworkInterfaceDnsSettings(Model): } def __init__(self, dns_servers=None, applied_dns_servers=None, internal_dns_name_label=None, internal_fqdn=None, internal_domain_name_suffix=None): + super(NetworkInterfaceDnsSettings, self).__init__() self.dns_servers = dns_servers self.applied_dns_servers = applied_dns_servers self.internal_dns_name_label = internal_dns_name_label diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/next_hop_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/next_hop_parameters.py index f38a8ce62abb..3e1478409a0a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/next_hop_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/next_hop_parameters.py @@ -42,6 +42,7 @@ class NextHopParameters(Model): } def __init__(self, target_resource_id, source_ip_address, destination_ip_address, target_nic_resource_id=None): + super(NextHopParameters, self).__init__() self.target_resource_id = target_resource_id self.source_ip_address = source_ip_address self.destination_ip_address = destination_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/next_hop_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/next_hop_result.py index cda1a8e49e7b..7b12ce6a69bd 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/next_hop_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/next_hop_result.py @@ -36,6 +36,7 @@ class NextHopResult(Model): } def __init__(self, next_hop_type=None, next_hop_ip_address=None, route_table_id=None): + super(NextHopResult, self).__init__() self.next_hop_type = next_hop_type self.next_hop_ip_address = next_hop_ip_address self.route_table_id = route_table_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture.py index ebe3cd77d5ce..9e553529baa2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture.py @@ -50,6 +50,7 @@ class PacketCapture(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCapture, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_filter.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_filter.py index bef1d7e92f26..158377603111 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_filter.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_filter.py @@ -52,6 +52,7 @@ class PacketCaptureFilter(Model): } def __init__(self, protocol="Any", local_ip_address=None, remote_ip_address=None, local_port=None, remote_port=None): + super(PacketCaptureFilter, self).__init__() self.protocol = protocol self.local_ip_address = local_ip_address self.remote_ip_address = remote_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_parameters.py index 94567f26332a..948bad5adc71 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_parameters.py @@ -50,6 +50,7 @@ class PacketCaptureParameters(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCaptureParameters, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_query_status_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_query_status_result.py index 9df985daee27..f87230ccb139 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_query_status_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_query_status_result.py @@ -44,6 +44,7 @@ class PacketCaptureQueryStatusResult(Model): } def __init__(self, name=None, id=None, capture_start_time=None, packet_capture_status=None, stop_reason=None, packet_capture_error=None): + super(PacketCaptureQueryStatusResult, self).__init__() self.name = name self.id = id self.capture_start_time = capture_start_time diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_result.py index c1b2d69454d9..b685dc902176 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_result.py @@ -71,6 +71,7 @@ class PacketCaptureResult(Model): } def __init__(self, target, storage_location, etag="A unique read-only string that changes whenever the resource is updated.", bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None, provisioning_state=None): + super(PacketCaptureResult, self).__init__() self.name = None self.id = None self.etag = etag diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_storage_location.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_storage_location.py index d0987d11ff9f..773b04d22501 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_storage_location.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/packet_capture_storage_location.py @@ -36,6 +36,7 @@ class PacketCaptureStorageLocation(Model): } def __init__(self, storage_id=None, storage_path=None, file_path=None): + super(PacketCaptureStorageLocation, self).__init__() self.storage_id = storage_id self.storage_path = storage_path self.file_path = file_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/public_ip_address_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/public_ip_address_dns_settings.py index 65a534407848..a248461f05d7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/public_ip_address_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/public_ip_address_dns_settings.py @@ -39,6 +39,7 @@ class PublicIPAddressDnsSettings(Model): } def __init__(self, domain_name_label=None, fqdn=None, reverse_fqdn=None): + super(PublicIPAddressDnsSettings, self).__init__() self.domain_name_label = domain_name_label self.fqdn = fqdn self.reverse_fqdn = reverse_fqdn diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/query_troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/query_troubleshooting_parameters.py index a394b181fcc5..9b6801eb7b63 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/query_troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/query_troubleshooting_parameters.py @@ -29,4 +29,5 @@ class QueryTroubleshootingParameters(Model): } def __init__(self, target_resource_id): + super(QueryTroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/resource.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/resource.py index 994440bac861..5dfb000318bf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/resource.py @@ -44,6 +44,7 @@ class Resource(Model): } def __init__(self, id=None, location=None, tags=None): + super(Resource, self).__init__() self.id = id self.name = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/retention_policy_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/retention_policy_parameters.py index 58f7f12cc6a9..102f4c5c3b4c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/retention_policy_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/retention_policy_parameters.py @@ -27,5 +27,6 @@ class RetentionPolicyParameters(Model): } def __init__(self, days=0, enabled=False): + super(RetentionPolicyParameters, self).__init__() self.days = days self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_network_interface.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_network_interface.py index b5e6721755e0..81bad6c3d83f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_network_interface.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_network_interface.py @@ -28,5 +28,6 @@ class SecurityGroupNetworkInterface(Model): } def __init__(self, id=None, security_rule_associations=None): + super(SecurityGroupNetworkInterface, self).__init__() self.id = id self.security_rule_associations = security_rule_associations diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_view_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_view_parameters.py index 304908dd4792..5c0972e5d55e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_view_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_view_parameters.py @@ -28,4 +28,5 @@ class SecurityGroupViewParameters(Model): } def __init__(self, target_resource_id): + super(SecurityGroupViewParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_view_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_view_result.py index 843891ef4db7..ecae72fce286 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_view_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_group_view_result.py @@ -25,4 +25,5 @@ class SecurityGroupViewResult(Model): } def __init__(self, network_interfaces=None): + super(SecurityGroupViewResult, self).__init__() self.network_interfaces = network_interfaces diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_rule_associations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_rule_associations.py index 799550743e1c..82027ab31003 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_rule_associations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_rule_associations.py @@ -38,6 +38,7 @@ class SecurityRuleAssociations(Model): } def __init__(self, network_interface_association=None, subnet_association=None, default_security_rules=None, effective_security_rules=None): + super(SecurityRuleAssociations, self).__init__() self.network_interface_association = network_interface_association self.subnet_association = subnet_association self.default_security_rules = default_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/sub_resource.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/sub_resource.py index e7fa13135e83..d4a564864add 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/sub_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/sub_resource.py @@ -24,4 +24,5 @@ class SubResource(Model): } def __init__(self, id=None): + super(SubResource, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/subnet_association.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/subnet_association.py index afd112f15eae..0f35ac1975da 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/subnet_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/subnet_association.py @@ -35,5 +35,6 @@ class SubnetAssociation(Model): } def __init__(self, security_rules=None): + super(SubnetAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology.py index 30c2af42f602..79f139ec13b8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology.py @@ -44,6 +44,7 @@ class Topology(Model): } def __init__(self, resources=None): + super(Topology, self).__init__() self.id = None self.created_date_time = None self.last_modified = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_association.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_association.py index 3b81cd70aa99..ec44a73b9f8c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_association.py @@ -34,6 +34,7 @@ class TopologyAssociation(Model): } def __init__(self, name=None, resource_id=None, association_type=None): + super(TopologyAssociation, self).__init__() self.name = name self.resource_id = resource_id self.association_type = association_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_parameters.py index c2f674cad7fc..04920dc9665d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_parameters.py @@ -29,4 +29,5 @@ class TopologyParameters(Model): } def __init__(self, target_resource_group_name): + super(TopologyParameters, self).__init__() self.target_resource_group_name = target_resource_group_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_resource.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_resource.py index c0e2d3100788..bb6f13c2a0d3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/topology_resource.py @@ -35,6 +35,7 @@ class TopologyResource(Model): } def __init__(self, name=None, id=None, location=None, associations=None): + super(TopologyResource, self).__init__() self.name = name self.id = id self.location = location diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_details.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_details.py index 96eff618bf7d..84a87a762683 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_details.py @@ -37,6 +37,7 @@ class TroubleshootingDetails(Model): } def __init__(self, id=None, reason_type=None, summary=None, detail=None, recommended_actions=None): + super(TroubleshootingDetails, self).__init__() self.id = id self.reason_type = reason_type self.summary = summary diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_parameters.py index d6bd7ebe04e6..c4833fb8eeb3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_parameters.py @@ -38,6 +38,7 @@ class TroubleshootingParameters(Model): } def __init__(self, target_resource_id, storage_id, storage_path): + super(TroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.storage_path = storage_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_recommended_actions.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_recommended_actions.py index 479eb32b8fa8..cbc5e31177c7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_recommended_actions.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_recommended_actions.py @@ -35,6 +35,7 @@ class TroubleshootingRecommendedActions(Model): } def __init__(self, action_id=None, action_text=None, action_uri=None, action_uri_text=None): + super(TroubleshootingRecommendedActions, self).__init__() self.action_id = action_id self.action_text = action_text self.action_uri = action_uri diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_result.py index 11e44fe41eae..2fcc5586d029 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/troubleshooting_result.py @@ -34,6 +34,7 @@ class TroubleshootingResult(Model): } def __init__(self, start_time=None, end_time=None, code=None, results=None): + super(TroubleshootingResult, self).__init__() self.start_time = start_time self.end_time = end_time self.code = code diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/tunnel_connection_health.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/tunnel_connection_health.py index 70828549cf32..b767820852b2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/tunnel_connection_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/tunnel_connection_health.py @@ -53,6 +53,7 @@ class TunnelConnectionHealth(Model): } def __init__(self): + super(TunnelConnectionHealth, self).__init__() self.tunnel = None self.connection_status = None self.ingress_bytes_transferred = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/usage.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/usage.py index 7fd329b582fb..2c711d84a428 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/usage.py @@ -46,6 +46,7 @@ class Usage(Model): unit = "Count" def __init__(self, current_value, limit, name): + super(Usage, self).__init__() self.current_value = current_value self.limit = limit self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/usage_name.py index 87786b60cf62..df7f344bfb9b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/usage_name.py @@ -27,5 +27,6 @@ class UsageName(Model): } def __init__(self, value=None, localized_value=None): + super(UsageName, self).__init__() self.value = value self.localized_value = localized_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/verification_ip_flow_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/verification_ip_flow_parameters.py index 52680b305055..a769920b56ec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/verification_ip_flow_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/verification_ip_flow_parameters.py @@ -66,6 +66,7 @@ class VerificationIPFlowParameters(Model): } def __init__(self, target_resource_id, direction, protocol, local_port, remote_port, local_ip_address, remote_ip_address, target_nic_resource_id=None): + super(VerificationIPFlowParameters, self).__init__() self.target_resource_id = target_resource_id self.direction = direction self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/verification_ip_flow_result.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/verification_ip_flow_result.py index 25540b1a9a81..8b8945ca9928 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/verification_ip_flow_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/verification_ip_flow_result.py @@ -29,5 +29,6 @@ class VerificationIPFlowResult(Model): } def __init__(self, access=None, rule_name=None): + super(VerificationIPFlowResult, self).__init__() self.access = access self.rule_name = rule_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/virtual_network_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/virtual_network_gateway_sku.py index d6ee81b27e78..9ad814a9cc5b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/virtual_network_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/virtual_network_gateway_sku.py @@ -36,6 +36,7 @@ class VirtualNetworkGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(VirtualNetworkGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/vpn_client_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/vpn_client_configuration.py index ae5ea34a323f..54625766785a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/vpn_client_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/vpn_client_configuration.py @@ -36,6 +36,7 @@ class VpnClientConfiguration(Model): } def __init__(self, vpn_client_address_pool=None, vpn_client_root_certificates=None, vpn_client_revoked_certificates=None): + super(VpnClientConfiguration, self).__init__() self.vpn_client_address_pool = vpn_client_address_pool self.vpn_client_root_certificates = vpn_client_root_certificates self.vpn_client_revoked_certificates = vpn_client_revoked_certificates diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/vpn_client_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/vpn_client_parameters.py index b3b524aff2f8..18346c2eed16 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/vpn_client_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/vpn_client_parameters.py @@ -30,4 +30,5 @@ class VpnClientParameters(Model): } def __init__(self, processor_architecture): + super(VpnClientParameters, self).__init__() self.processor_architecture = processor_architecture diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/network_management_client.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/network_management_client.py index 32b9a8af8b8b..79346f362a0a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/network_management_client.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/network_management_client.py @@ -251,7 +251,7 @@ def check_dns_name_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/application_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/application_gateways_operations.py index e698e047d397..2172cc2dbc6c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/application_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/application_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param parameters: Parameters supplied to the create or update - application gateway operation. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.ApplicationGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ApplicationGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ApplicationGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update + application gateway operation. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.ApplicationGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ApplicationGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('ApplicationGateway', response) + deserialized = self._deserialize('ApplicationGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -381,7 +431,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -400,23 +450,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def start( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Starts the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _start_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start' path_format_arguments = { @@ -441,18 +477,58 @@ def start( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 start( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Starts the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._start_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -465,10 +541,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -476,23 +548,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Stops the specified application gateway in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop' path_format_arguments = { @@ -517,18 +575,58 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def stop( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Stops the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -541,10 +639,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -552,28 +646,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def backend_health( - self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Gets the backend health of the specified application gateway in a - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param expand: Expands BackendAddressPool and BackendHttpSettings - referenced in backend health. - :type expand: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGatewayBackendHealth or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ApplicationGatewayBackendHealth] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _backend_health_initial( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth' path_format_arguments = { @@ -600,18 +675,71 @@ def backend_health( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ApplicationGatewayBackendHealth', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def backend_health( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets the backend health of the specified application gateway in a + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param expand: Expands BackendAddressPool and BackendHttpSettings + referenced in backend health. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGatewayBackendHealth or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ApplicationGatewayBackendHealth] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._backend_health_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + expand=expand, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -620,10 +748,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) + deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -631,10 +756,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/bgp_service_communities_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/bgp_service_communities_operations.py index e1fa9ac0818d..1cfe5159a631 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/bgp_service_communities_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/bgp_service_communities_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuit_authorizations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuit_authorizations_operations.py index 4265144379c5..6fd7d2f9a02a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuit_authorizations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuit_authorizations_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified authorization from the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified authorization from the specified express route + circuit. - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,31 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an authorization in the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param authorization_parameters: Parameters supplied to the create or - update express route circuit authorization operation. - :type authorization_parameters: - ~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitAuthorization - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitAuthorization] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -238,19 +240,78 @@ def create_or_update( body_content = self._serialize.body(authorization_parameters, 'ExpressRouteCircuitAuthorization') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization in the specified express route + circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or + update express route circuit authorization operation. + :type authorization_parameters: + ~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitAuthorization + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitAuthorization] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + authorization_parameters=authorization_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -259,12 +320,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -272,10 +328,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuit_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuit_peerings_operations.py index e1f5862de573..b8b81d2f8796 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuit_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuit_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified peering from the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified peering from the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified express route circuits. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param peering_parameters: Parameters supplied to the create or update - express route circuit peering operation. - :type peering_parameters: - ~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(peering_parameters, 'ExpressRouteCircuitPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + express route circuit peering operation. + :type peering_parameters: + ~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + peering_parameters=peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuits_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuits_operations.py index 5311a1e5a1bc..e80178deba2c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuits_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuits_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the circuit. - :type circuit_name: str - :param parameters: Parameters supplied to the create or update express - route circuit operation. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuit - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuit or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuit] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ExpressRouteCircuit') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuit', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuit', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the circuit. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express + route circuit operation. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuit + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuit or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuit] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuit', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuit', response) + deserialized = self._deserialize('ExpressRouteCircuit', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -269,30 +319,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_arp_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised ARP table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsArpTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitsArpTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_arp_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}' path_format_arguments = { @@ -319,18 +348,74 @@ def list_arp_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ExpressRouteCircuitsArpTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_arp_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised ARP table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsArpTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitsArpTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_arp_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -339,10 +424,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -350,10 +432,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -361,30 +439,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitsRoutesTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}' path_format_arguments = { @@ -411,18 +468,74 @@ def list_routes_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsRoutesTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitsRoutesTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -431,10 +544,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -442,10 +552,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -453,30 +559,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table_summary( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table summary associated with the - express route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse - if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_summary_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}' path_format_arguments = { @@ -503,18 +588,74 @@ def list_routes_table_summary( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table_summary( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table summary associated with the + express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse + if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -523,10 +664,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -534,10 +672,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -589,7 +723,7 @@ def get_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -654,7 +788,7 @@ def get_peering_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -720,7 +854,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -784,7 +918,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_service_providers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_service_providers_operations.py index 411a755fb1fc..14225124ec57 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_service_providers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/express_route_service_providers_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/load_balancers_operations.py index 316ce52a254f..e2ad71203224 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/load_balancers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param parameters: Parameters supplied to the create or update load - balancer operation. - :type parameters: ~azure.mgmt.network.v2016_12_01.models.LoadBalancer - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns LoadBalancer - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.LoadBalancer] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LoadBalancer') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LoadBalancer', response) + if response.status_code == 201: + deserialized = self._deserialize('LoadBalancer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load + balancer operation. + :type parameters: ~azure.mgmt.network.v2016_12_01.models.LoadBalancer + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns LoadBalancer + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.LoadBalancer] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LoadBalancer', response) - if response.status_code == 201: - deserialized = self._deserialize('LoadBalancer', response) + deserialized = self._deserialize('LoadBalancer', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/local_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/local_network_gateways_operations.py index 8faab8241dd9..581dc04e89be 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/local_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/local_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a local network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param parameters: Parameters supplied to the create or update local - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.LocalNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - LocalNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.LocalNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LocalNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocalNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('LocalNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a local network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.LocalNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + LocalNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.LocalNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LocalNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('LocalNetworkGateway', response) + deserialized = self._deserialize('LocalNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified local network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified local network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_interfaces_operations.py index ee142ff7e7a0..dff3708f491c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_interfaces_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -94,7 +95,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -167,7 +168,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -242,7 +243,7 @@ def get_virtual_machine_scale_set_network_interface( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -260,23 +261,9 @@ def get_virtual_machine_scale_set_network_interface( return deserialized - def delete( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2016-12-01" # Construct URL @@ -303,18 +290,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -327,10 +354,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -387,7 +410,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -405,28 +428,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param parameters: Parameters supplied to the create or update network - interface operation. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.NetworkInterface - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkInterface or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.NetworkInterface] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2016-12-01" # Construct URL @@ -456,19 +460,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkInterface') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkInterface', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkInterface', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network + interface operation. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.NetworkInterface + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkInterface or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.NetworkInterface] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -477,12 +536,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkInterface', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkInterface', response) + deserialized = self._deserialize('NetworkInterface', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -490,10 +544,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -548,7 +598,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -617,7 +667,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -636,24 +686,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def get_effective_route_table( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all route tables applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.EffectiveRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_effective_route_table_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2016-12-01" # Construct URL @@ -680,18 +715,66 @@ def get_effective_route_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_effective_route_table( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all route tables applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.EffectiveRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_effective_route_table_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -700,10 +783,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveRouteListResult', response) + deserialized = self._deserialize('EffectiveRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -711,10 +791,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -722,25 +798,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_effective_network_security_groups( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all network security groups applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveNetworkSecurityGroupListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.EffectiveNetworkSecurityGroupListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_effective_network_security_groups_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2016-12-01" # Construct URL @@ -767,18 +827,67 @@ def list_effective_network_security_groups( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveNetworkSecurityGroupListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_effective_network_security_groups( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all network security groups applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveNetworkSecurityGroupListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.EffectiveNetworkSecurityGroupListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_effective_network_security_groups_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -787,10 +896,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) + deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -798,10 +904,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_security_groups_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_security_groups_operations.py index 2769be6d9a6c..9f51ddb50780 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_security_groups_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_security_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,24 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -80,18 +66,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def delete( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -104,10 +131,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network security group in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param parameters: Parameters supplied to the create or update network - security group operation. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.NetworkSecurityGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.NetworkSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -232,19 +234,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkSecurityGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network security group in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network + security group operation. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.NetworkSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.NetworkSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkSecurityGroup', response) + deserialized = self._deserialize('NetworkSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -322,7 +372,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -389,7 +439,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_watchers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_watchers_operations.py index c19c665279fb..e31cd1ae6f83 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_watchers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/network_watchers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -152,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -170,23 +171,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network watcher resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}' path_format_arguments = { @@ -211,18 +198,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network watcher resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -235,10 +262,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -294,7 +317,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -358,7 +381,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -429,7 +452,7 @@ def get_topology( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -447,28 +470,9 @@ def get_topology( return deserialized - def verify_ip_flow( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Verify IP flow from the specified VM to a location given the currently - configured NSG rules. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the IP flow to be verified. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.VerificationIPFlowParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VerificationIPFlowResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VerificationIPFlowResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _verify_ip_flow_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify' path_format_arguments = { @@ -496,19 +500,74 @@ def verify_ip_flow( body_content = self._serialize.body(parameters, 'VerificationIPFlowParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('VerificationIPFlowResult', response) + if response.status_code == 202: + deserialized = self._deserialize('VerificationIPFlowResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def verify_ip_flow( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Verify IP flow from the specified VM to a location given the currently + configured NSG rules. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.VerificationIPFlowParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VerificationIPFlowResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VerificationIPFlowResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._verify_ip_flow_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -517,12 +576,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VerificationIPFlowResult', response) - if response.status_code == 202: - deserialized = self._deserialize('VerificationIPFlowResult', response) + deserialized = self._deserialize('VerificationIPFlowResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -530,10 +584,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -541,28 +591,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_next_hop( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Gets the next hop from the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the source and destination - endpoint. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.NextHopParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NextHopResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.NextHopResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_next_hop_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop' path_format_arguments = { @@ -590,19 +621,74 @@ def get_next_hop( body_content = self._serialize.body(parameters, 'NextHopParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('NextHopResult', response) + if response.status_code == 202: + deserialized = self._deserialize('NextHopResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_next_hop( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination + endpoint. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.NextHopParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NextHopResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.NextHopResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_next_hop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -611,12 +697,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NextHopResult', response) - if response.status_code == 202: - deserialized = self._deserialize('NextHopResult', response) + deserialized = self._deserialize('NextHopResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -624,10 +705,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -635,27 +712,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_vm_security_rules( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Gets the configured and effective security group rules on the specified - VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param target_resource_id: ID of the target VM. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - SecurityGroupViewResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.SecurityGroupViewResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_vm_security_rules_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.SecurityGroupViewParameters(target_resource_id=target_resource_id) # Construct URL @@ -685,19 +744,73 @@ def get_vm_security_rules( body_content = self._serialize.body(parameters, 'SecurityGroupViewParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('SecurityGroupViewResult', response) + if response.status_code == 202: + deserialized = self._deserialize('SecurityGroupViewResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_vm_security_rules( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the configured and effective security group rules on the specified + VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param target_resource_id: ID of the target VM. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + SecurityGroupViewResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.SecurityGroupViewResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_vm_security_rules_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -706,12 +819,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityGroupViewResult', response) - if response.status_code == 202: - deserialized = self._deserialize('SecurityGroupViewResult', response) + deserialized = self._deserialize('SecurityGroupViewResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -719,10 +827,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -730,28 +834,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Initiate troubleshooting on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the resource to - troubleshoot. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.TroubleshootingParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot' path_format_arguments = { @@ -779,19 +864,74 @@ def get_troubleshooting( body_content = self._serialize.body(parameters, 'TroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to + troubleshoot. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.TroubleshootingParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -800,12 +940,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -813,10 +948,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -824,27 +955,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting_result( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Get the last completed troubleshooting result on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource ID to query the - troubleshooting result. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_result_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.QueryTroubleshootingParameters(target_resource_id=target_resource_id) # Construct URL @@ -874,19 +987,73 @@ def get_troubleshooting_result( body_content = self._serialize.body(parameters, 'QueryTroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting_result( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource ID to query the + troubleshooting result. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_result_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -895,12 +1062,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -908,10 +1070,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -919,29 +1077,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_flow_log_configuration( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Configures flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the configuration of flow - log. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.FlowLogInformation - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_flow_log_configuration_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog' path_format_arguments = { @@ -969,19 +1107,75 @@ def set_flow_log_configuration( body_content = self._serialize.body(parameters, 'FlowLogInformation') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_flow_log_configuration( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Configures flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow + log. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.FlowLogInformation + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_flow_log_configuration_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -990,12 +1184,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1003,10 +1192,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1014,28 +1199,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_flow_log_status( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Queries status of flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource where getting the flow - logging status. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_flow_log_status_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.FlowLogStatusParameters(target_resource_id=target_resource_id) # Construct URL @@ -1065,19 +1231,74 @@ def get_flow_log_status( body_content = self._serialize.body(parameters, 'FlowLogStatusParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_flow_log_status( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Queries status of flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource where getting the flow + logging status. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_flow_log_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1086,12 +1307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1099,10 +1315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/packet_captures_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/packet_captures_operations.py index c328c746c803..835fd6df53a0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/packet_captures_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/packet_captures_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,29 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create( - self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create and start a packet capture on the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param parameters: Parameters that define the create packet capture - operation. - :type parameters: ~azure.mgmt.network.v2016_12_01.models.PacketCapture - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.PacketCaptureResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -89,19 +70,74 @@ def create( body_content = self._serialize.body(parameters, 'PacketCapture') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('PacketCaptureResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture + operation. + :type parameters: ~azure.mgmt.network.v2016_12_01.models.PacketCapture + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.PacketCaptureResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,10 +146,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('PacketCaptureResult', response) + deserialized = self._deserialize('PacketCaptureResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -121,10 +154,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +207,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,25 +225,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -240,18 +253,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -264,10 +320,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -275,25 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Stops a specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop' path_format_arguments = { @@ -319,18 +355,61 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 stop( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Stops a specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +422,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -354,27 +429,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_status( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Query the status of a running packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the Network Watcher resource. - :type network_watcher_name: str - :param packet_capture_name: The name given to the packet capture - session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureQueryStatusResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.PacketCaptureQueryStatusResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_status_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus' path_format_arguments = { @@ -400,18 +457,72 @@ def get_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('PacketCaptureQueryStatusResult', response) + if response.status_code == 202: + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_status( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Query the status of a running packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param packet_capture_name: The name given to the packet capture + session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureQueryStatusResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.PacketCaptureQueryStatusResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -420,12 +531,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) - if response.status_code == 202: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -433,10 +539,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -495,7 +597,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/public_ip_addresses_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/public_ip_addresses_operations.py index 232e793c7f19..19489378ea86 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/public_ip_addresses_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/public_ip_addresses_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the subnet. - :type public_ip_address_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the subnet. + :type public_ip_address_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a static or dynamic public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the public IP address. - :type public_ip_address_name: str - :param parameters: Parameters supplied to the create or update public - IP address operation. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.PublicIPAddress - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PublicIPAddress or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.PublicIPAddress] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'PublicIPAddress') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PublicIPAddress', response) + if response.status_code == 201: + deserialized = self._deserialize('PublicIPAddress', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public + IP address operation. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.PublicIPAddress + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PublicIPAddress or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.PublicIPAddress] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PublicIPAddress', response) - if response.status_code == 201: - deserialized = self._deserialize('PublicIPAddress', response) + deserialized = self._deserialize('PublicIPAddress', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_filter_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_filter_rules_operations.py index 35bca99030a5..7aa7ba3f1ee3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_filter_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_filter_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified rule from a route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the rule. - :type rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified rule from a route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the create - or update route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2016_12_01.models.RouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -233,19 +236,77 @@ def create_or_update( body_content = self._serialize.body(route_filter_rule_parameters, 'RouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create + or update route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2016_12_01.models.RouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -254,12 +315,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -267,10 +323,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -278,30 +330,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the update - route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2016_12_01.models.PatchRouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -330,19 +361,75 @@ def update( body_content = self._serialize.body(route_filter_rule_parameters, 'PatchRouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the update + route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2016_12_01.models.PatchRouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -351,10 +438,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -362,10 +446,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -424,7 +504,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_filters_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_filters_operations.py index ea58295464b7..d204660de5ce 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_filters_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_filters_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the create or - update route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2016_12_01.models.RouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(route_filter_parameters, 'RouteFilter') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or + update route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2016_12_01.models.RouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,28 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the update - route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2016_12_01.models.PatchRouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -322,19 +353,72 @@ def update( body_content = self._serialize.body(route_filter_parameters, 'PatchRouteFilter') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the update + route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2016_12_01.models.PatchRouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +427,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -354,10 +435,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -413,7 +490,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -477,7 +554,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_tables_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_tables_operations.py index 0b47617dc842..5af386bb509b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_tables_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/route_tables_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create or updates a route table in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param parameters: Parameters supplied to the create or update route - table operation. - :type parameters: ~azure.mgmt.network.v2016_12_01.models.RouteTable - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteTable - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.RouteTable] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'RouteTable') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteTable', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route + table operation. + :type parameters: ~azure.mgmt.network.v2016_12_01.models.RouteTable + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteTable + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.RouteTable] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteTable', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteTable', response) + deserialized = self._deserialize('RouteTable', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -320,7 +370,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/routes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/routes_operations.py index c931c76cedd0..afd5c82889d8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/routes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/routes_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route from a route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route from a route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,29 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param route_parameters: Parameters supplied to the create or update - route operation. - :type route_parameters: ~azure.mgmt.network.v2016_12_01.models.Route - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Route or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.Route] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -232,19 +236,76 @@ def create_or_update( body_content = self._serialize.body(route_parameters, 'Route') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Route', response) + if response.status_code == 201: + deserialized = self._deserialize('Route', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update + route operation. + :type route_parameters: ~azure.mgmt.network.v2016_12_01.models.Route + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Route or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.Route] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + route_parameters=route_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +314,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Route', response) - if response.status_code == 201: - deserialized = self._deserialize('Route', response) + deserialized = self._deserialize('Route', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +322,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -328,7 +380,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/security_rules_operations.py index 01594e76d846..1ad870dd9744 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/security_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,32 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a security rule in the specified network security - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param security_rule_parameters: Parameters supplied to the create or - update network security rule operation. - :type security_rule_parameters: - ~azure.mgmt.network.v2016_12_01.models.SecurityRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns SecurityRule - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.SecurityRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -237,19 +238,79 @@ def create_or_update( body_content = self._serialize.body(security_rule_parameters, 'SecurityRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SecurityRule', response) + if response.status_code == 201: + deserialized = self._deserialize('SecurityRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a security rule in the specified network security + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or + update network security rule operation. + :type security_rule_parameters: + ~azure.mgmt.network.v2016_12_01.models.SecurityRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns SecurityRule + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.SecurityRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + security_rule_parameters=security_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -258,12 +319,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityRule', response) - if response.status_code == 201: - deserialized = self._deserialize('SecurityRule', response) + deserialized = self._deserialize('SecurityRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -271,10 +327,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/subnets_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/subnets_operations.py index dec1bd8e671c..5bcc71ecc745 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/subnets_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/subnets_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified subnet. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified subnet. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,29 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a subnet in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param subnet_parameters: Parameters supplied to the create or update - subnet operation. - :type subnet_parameters: ~azure.mgmt.network.v2016_12_01.models.Subnet - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Subnet or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.Subnet] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -236,19 +240,76 @@ def create_or_update( body_content = self._serialize.body(subnet_parameters, 'Subnet') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Subnet', response) + if response.status_code == 201: + deserialized = self._deserialize('Subnet', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update + subnet operation. + :type subnet_parameters: ~azure.mgmt.network.v2016_12_01.models.Subnet + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Subnet or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.Subnet] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subnet_parameters=subnet_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -257,12 +318,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Subnet', response) - if response.status_code == 201: - deserialized = self._deserialize('Subnet', response) + deserialized = self._deserialize('Subnet', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -270,10 +326,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -332,7 +384,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/usages_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/usages_operations.py index 87c52184edee..c5cc53c44276 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/usages_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/usages_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_gateway_connections_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_gateway_connections_operations.py index e31413c64555..6ca06f7cd873 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_gateway_connections_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_gateway_connections_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway connection in the - specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param parameters: Parameters supplied to the create or update virtual - network gateway connection operation. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.VirtualNetworkGatewayConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGatewayConnection or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VirtualNetworkGatewayConnection] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGatewayConnection') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway connection in the + specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual + network gateway connection operation. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.VirtualNetworkGatewayConnection + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGatewayConnection or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VirtualNetworkGatewayConnection] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -181,7 +209,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -199,24 +227,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network Gateway connection. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -241,18 +254,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network Gateway connection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -265,10 +319,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -276,30 +326,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): - """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection name. - :type virtual_network_gateway_connection_name: str - :param value: The virtual network connection shared key value. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ConnectionSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionSharedKey(value=value) # Construct URL @@ -329,19 +358,76 @@ def set_shared_key( body_content = self._serialize.body(parameters, 'ConnectionSharedKey') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConnectionSharedKey', response) + if response.status_code == 201: + deserialized = self._deserialize('ConnectionSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection name. + :type virtual_network_gateway_connection_name: str + :param value: The virtual network connection shared key value. + :type value: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ConnectionSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + value=value, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -350,12 +436,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionSharedKey', response) - if response.status_code == 201: - deserialized = self._deserialize('ConnectionSharedKey', response) + deserialized = self._deserialize('ConnectionSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -363,10 +444,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -420,7 +497,7 @@ def get_shared_key( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -487,7 +564,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -506,31 +583,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): - """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection reset shared key Name. - :type virtual_network_gateway_connection_name: str - :param key_length: The virtual network connection reset shared key - length, should between 1 and 128. - :type key_length: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionResetSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ConnectionResetSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionResetSharedKey(key_length=key_length) # Construct URL @@ -560,19 +615,75 @@ def reset_shared_key( body_content = self._serialize.body(parameters, 'ConnectionResetSharedKey') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectionResetSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection reset shared key Name. + :type virtual_network_gateway_connection_name: str + :param key_length: The virtual network connection reset shared key + length, should between 1 and 128. + :type key_length: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionResetSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.ConnectionResetSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + key_length=key_length, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -581,10 +692,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionResetSharedKey', response) + deserialized = self._deserialize('ConnectionResetSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -592,10 +700,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_gateways_operations.py index 7d68f1a20888..d39d99a08910 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to create or update virtual - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.VirtualNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.VirtualNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -340,29 +390,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset( - self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): - """Resets the primary of the virtual network gateway in the specified - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param gateway_vip: Virtual network gateway vip address supplied to - the begin reset of the active-active feature enabled gateway. - :type gateway_vip: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_initial( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset' path_format_arguments = { @@ -389,18 +419,72 @@ def reset( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): + """Resets the primary of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param gateway_vip: Virtual network gateway vip address supplied to + the begin reset of the active-active feature enabled gateway. + :type gateway_vip: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + gateway_vip=gateway_vip, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -409,10 +493,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -420,10 +501,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -486,7 +563,7 @@ def generatevpnclientpackage( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [202]: exp = CloudError(response) @@ -504,27 +581,9 @@ def generatevpnclientpackage( return deserialized - def get_bgp_peer_status( - self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): - """The GetBgpPeerStatus operation retrieves the status of all BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer to retrieve the status of. - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - BgpPeerStatusListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.BgpPeerStatusListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_bgp_peer_status_initial( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus' path_format_arguments = { @@ -551,18 +610,70 @@ def get_bgp_peer_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BgpPeerStatusListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_bgp_peer_status( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): + """The GetBgpPeerStatus operation retrieves the status of all BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer to retrieve the status of. + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + BgpPeerStatusListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.BgpPeerStatusListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_bgp_peer_status_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -571,10 +682,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BgpPeerStatusListResult', response) + deserialized = self._deserialize('BgpPeerStatusListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -582,10 +690,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -593,26 +697,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_learned_routes( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - has learned, including routes learned from BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_learned_routes_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes' path_format_arguments = { @@ -637,18 +724,68 @@ def get_learned_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_learned_routes( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + has learned, including routes learned from BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_learned_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -657,10 +794,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -668,10 +802,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -679,28 +809,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_advertised_routes( - self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - is advertising to the specified peer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_advertised_routes_initial( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes' path_format_arguments = { @@ -726,18 +837,71 @@ def get_advertised_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_advertised_routes( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + is advertising to the specified peer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_advertised_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -746,10 +910,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -757,10 +918,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_peerings_operations.py index 13646a6e97ae..f3b33dc16acc 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network peering. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the virtual network - peering. - :type virtual_network_peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network + peering. + :type virtual_network_peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the peering. - :type virtual_network_peering_name: str - :param virtual_network_peering_parameters: Parameters supplied to the - create or update virtual network peering operation. - :type virtual_network_peering_parameters: - ~azure.mgmt.network.v2016_12_01.models.VirtualNetworkPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VirtualNetworkPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(virtual_network_peering_parameters, 'VirtualNetworkPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the + create or update virtual network peering operation. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2016_12_01.models.VirtualNetworkPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VirtualNetworkPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + virtual_network_peering_parameters=virtual_network_peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkPeering', response) + deserialized = self._deserialize('VirtualNetworkPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_networks_operations.py b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_networks_operations.py index b388df0fa915..59355cb9c162 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_networks_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_networks_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network in the specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to the create or update virtual - network operation - :type parameters: - ~azure.mgmt.network.v2016_12_01.models.VirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetwork or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VirtualNetwork] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetwork') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetwork', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual + network operation + :type parameters: + ~azure.mgmt.network.v2016_12_01.models.VirtualNetwork + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetwork or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2016_12_01.models.VirtualNetwork] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetwork', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetwork', response) + deserialized = self._deserialize('VirtualNetwork', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -452,7 +502,7 @@ def check_ip_address_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/address_space.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/address_space.py index 4ff6fb3af6d8..d7050c78a457 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/address_space.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/address_space.py @@ -26,4 +26,5 @@ class AddressSpace(Model): } def __init__(self, address_prefixes=None): + super(AddressSpace, self).__init__() self.address_prefixes = address_prefixes diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_available_waf_rule_sets_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_available_waf_rule_sets_result.py index b9d0183d1e9b..fe63490ea5bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_available_waf_rule_sets_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_available_waf_rule_sets_result.py @@ -25,4 +25,5 @@ class ApplicationGatewayAvailableWafRuleSetsResult(Model): } def __init__(self, value=None): + super(ApplicationGatewayAvailableWafRuleSetsResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_address.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_address.py index 5ff5ce4b4a5c..6005027d0845 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_address.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_address.py @@ -27,5 +27,6 @@ class ApplicationGatewayBackendAddress(Model): } def __init__(self, fqdn=None, ip_address=None): + super(ApplicationGatewayBackendAddress, self).__init__() self.fqdn = fqdn self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health.py index 7cb3aff34158..c751d53a3b63 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health.py @@ -25,4 +25,5 @@ class ApplicationGatewayBackendHealth(Model): } def __init__(self, backend_address_pools=None): + super(ApplicationGatewayBackendHealth, self).__init__() self.backend_address_pools = backend_address_pools diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_http_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_http_settings.py index d16cbdf14795..0e427c403ec9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_http_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_http_settings.py @@ -30,5 +30,6 @@ class ApplicationGatewayBackendHealthHttpSettings(Model): } def __init__(self, backend_http_settings=None, servers=None): + super(ApplicationGatewayBackendHealthHttpSettings, self).__init__() self.backend_http_settings = backend_http_settings self.servers = servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_pool.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_pool.py index 466d4db473a7..aa7b650f29f0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_pool.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_pool.py @@ -31,5 +31,6 @@ class ApplicationGatewayBackendHealthPool(Model): } def __init__(self, backend_address_pool=None, backend_http_settings_collection=None): + super(ApplicationGatewayBackendHealthPool, self).__init__() self.backend_address_pool = backend_address_pool self.backend_http_settings_collection = backend_http_settings_collection diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_server.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_server.py index e64fd4f7f64a..945cd10458aa 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_server.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_backend_health_server.py @@ -32,6 +32,7 @@ class ApplicationGatewayBackendHealthServer(Model): } def __init__(self, address=None, ip_configuration=None, health=None): + super(ApplicationGatewayBackendHealthServer, self).__init__() self.address = address self.ip_configuration = ip_configuration self.health = health diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_connection_draining.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_connection_draining.py index e1912ca67c62..8f9b88b571e2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_connection_draining.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_connection_draining.py @@ -35,5 +35,6 @@ class ApplicationGatewayConnectionDraining(Model): } def __init__(self, enabled, drain_timeout_in_sec): + super(ApplicationGatewayConnectionDraining, self).__init__() self.enabled = enabled self.drain_timeout_in_sec = drain_timeout_in_sec diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_disabled_rule_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_disabled_rule_group.py index cac1f2bd38e0..02c88980e857 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_disabled_rule_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_disabled_rule_group.py @@ -32,5 +32,6 @@ class ApplicationGatewayFirewallDisabledRuleGroup(Model): } def __init__(self, rule_group_name, rules=None): + super(ApplicationGatewayFirewallDisabledRuleGroup, self).__init__() self.rule_group_name = rule_group_name self.rules = rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_rule.py index 74db98eb4e23..f3f7da7cc11b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_rule.py @@ -31,5 +31,6 @@ class ApplicationGatewayFirewallRule(Model): } def __init__(self, rule_id, description=None): + super(ApplicationGatewayFirewallRule, self).__init__() self.rule_id = rule_id self.description = description diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_rule_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_rule_group.py index 6023cb284d90..d6fe0efec807 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_rule_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_firewall_rule_group.py @@ -38,6 +38,7 @@ class ApplicationGatewayFirewallRuleGroup(Model): } def __init__(self, rule_group_name, rules, description=None): + super(ApplicationGatewayFirewallRuleGroup, self).__init__() self.rule_group_name = rule_group_name self.description = description self.rules = rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_sku.py index 8782c0a01e10..14f55a4d269a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_sku.py @@ -35,6 +35,7 @@ class ApplicationGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(ApplicationGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_ssl_policy.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_ssl_policy.py index 87667b6858cc..6ef0a3a8126e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_ssl_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_ssl_policy.py @@ -26,4 +26,5 @@ class ApplicationGatewaySslPolicy(Model): } def __init__(self, disabled_ssl_protocols=None): + super(ApplicationGatewaySslPolicy, self).__init__() self.disabled_ssl_protocols = disabled_ssl_protocols diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_web_application_firewall_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_web_application_firewall_configuration.py index 78c7f36273b4..4bf078062fc7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_web_application_firewall_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_web_application_firewall_configuration.py @@ -47,6 +47,7 @@ class ApplicationGatewayWebApplicationFirewallConfiguration(Model): } def __init__(self, enabled, firewall_mode, rule_set_type, rule_set_version, disabled_rule_groups=None): + super(ApplicationGatewayWebApplicationFirewallConfiguration, self).__init__() self.enabled = enabled self.firewall_mode = firewall_mode self.rule_set_type = rule_set_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/azure_async_operation_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/azure_async_operation_result.py index 5f44f5fff815..f1daec4d317b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/azure_async_operation_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/azure_async_operation_result.py @@ -37,5 +37,6 @@ class AzureAsyncOperationResult(Model): } def __init__(self, status=None, error=None): + super(AzureAsyncOperationResult, self).__init__() self.status = status self.error = error diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_community.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_community.py index 197235cc5e9e..a2162c1ecfec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_community.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_community.py @@ -36,6 +36,7 @@ class BGPCommunity(Model): } def __init__(self, service_supported_region=None, community_name=None, community_value=None, community_prefixes=None): + super(BGPCommunity, self).__init__() self.service_supported_region = service_supported_region self.community_name = community_name self.community_value = community_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_peer_status.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_peer_status.py index d22e73b4021e..90375e1e2577 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_peer_status.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_peer_status.py @@ -60,6 +60,7 @@ class BgpPeerStatus(Model): } def __init__(self): + super(BgpPeerStatus, self).__init__() self.local_address = None self.neighbor = None self.asn = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_peer_status_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_peer_status_list_result.py index 2ed4a44be486..9309e21b7336 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_peer_status_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_peer_status_list_result.py @@ -24,4 +24,5 @@ class BgpPeerStatusListResult(Model): } def __init__(self, value=None): + super(BgpPeerStatusListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_settings.py index d62cc30ab0c7..c5730da2e43e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/bgp_settings.py @@ -32,6 +32,7 @@ class BgpSettings(Model): } def __init__(self, asn=None, bgp_peering_address=None, peer_weight=None): + super(BgpSettings, self).__init__() self.asn = asn self.bgp_peering_address = bgp_peering_address self.peer_weight = peer_weight diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connection_reset_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connection_reset_shared_key.py index 10bfdc9ba17d..3338112a7fe7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connection_reset_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connection_reset_shared_key.py @@ -29,4 +29,5 @@ class ConnectionResetSharedKey(Model): } def __init__(self, key_length): + super(ConnectionResetSharedKey, self).__init__() self.key_length = key_length diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connection_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connection_shared_key.py index 0dbbc36cc798..2c1b0ed9a914 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connection_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connection_shared_key.py @@ -28,4 +28,5 @@ class ConnectionSharedKey(Model): } def __init__(self, value): + super(ConnectionSharedKey, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_destination.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_destination.py index 756dfadfdd49..cd0e8818b591 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_destination.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_destination.py @@ -32,6 +32,7 @@ class ConnectivityDestination(Model): } def __init__(self, resource_id=None, address=None, port=None): + super(ConnectivityDestination, self).__init__() self.resource_id = resource_id self.address = address self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_hop.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_hop.py index eef0f78a782b..ddae3cd91008 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_hop.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_hop.py @@ -52,6 +52,7 @@ class ConnectivityHop(Model): } def __init__(self): + super(ConnectivityHop, self).__init__() self.type = None self.id = None self.address = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_information.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_information.py index f710547f6763..8cdc0ff3f8c6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_information.py @@ -58,6 +58,7 @@ class ConnectivityInformation(Model): } def __init__(self): + super(ConnectivityInformation, self).__init__() self.hops = None self.connection_status = None self.avg_latency_in_ms = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_issue.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_issue.py index 3b8ab144aa01..182a4701a5f8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_issue.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_issue.py @@ -48,6 +48,7 @@ class ConnectivityIssue(Model): } def __init__(self): + super(ConnectivityIssue, self).__init__() self.origin = None self.severity = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_parameters.py index 38624d327783..608a58b1a213 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_parameters.py @@ -33,5 +33,6 @@ class ConnectivityParameters(Model): } def __init__(self, source, destination): + super(ConnectivityParameters, self).__init__() self.source = source self.destination = destination diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_source.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_source.py index 8c7034e63c32..c42bfc0aa09d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_source.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/connectivity_source.py @@ -33,5 +33,6 @@ class ConnectivitySource(Model): } def __init__(self, resource_id, port=None): + super(ConnectivitySource, self).__init__() self.resource_id = resource_id self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/dhcp_options.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/dhcp_options.py index 2262eb5ec2f1..8744ba6fc9b1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/dhcp_options.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/dhcp_options.py @@ -26,4 +26,5 @@ class DhcpOptions(Model): } def __init__(self, dns_servers=None): + super(DhcpOptions, self).__init__() self.dns_servers = dns_servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/dns_name_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/dns_name_availability_result.py index 4be1851d2f59..15a0238e49a7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/dns_name_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/dns_name_availability_result.py @@ -24,4 +24,5 @@ class DnsNameAvailabilityResult(Model): } def __init__(self, available=None): + super(DnsNameAvailabilityResult, self).__init__() self.available = available diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group.py index c8253ea755bf..197e9ca5ccc3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group.py @@ -34,6 +34,7 @@ class EffectiveNetworkSecurityGroup(Model): } def __init__(self, network_security_group=None, association=None, effective_security_rules=None): + super(EffectiveNetworkSecurityGroup, self).__init__() self.network_security_group = network_security_group self.association = association self.effective_security_rules = effective_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group_association.py index 1644c7306e7c..6bd37771bbfd 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group_association.py @@ -28,5 +28,6 @@ class EffectiveNetworkSecurityGroupAssociation(Model): } def __init__(self, subnet=None, network_interface=None): + super(EffectiveNetworkSecurityGroupAssociation, self).__init__() self.subnet = subnet self.network_interface = network_interface diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group_list_result.py index c7b3971b5456..c6571aea3afa 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group_list_result.py @@ -28,5 +28,6 @@ class EffectiveNetworkSecurityGroupListResult(Model): } def __init__(self, value=None, next_link=None): + super(EffectiveNetworkSecurityGroupListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_rule.py index c930699c07f5..d9cdffa1a4a1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_rule.py @@ -63,6 +63,7 @@ class EffectiveNetworkSecurityRule(Model): } def __init__(self, name=None, protocol=None, source_port_range=None, destination_port_range=None, source_address_prefix=None, destination_address_prefix=None, expanded_source_address_prefix=None, expanded_destination_address_prefix=None, access=None, priority=None, direction=None): + super(EffectiveNetworkSecurityRule, self).__init__() self.name = name self.protocol = protocol self.source_port_range = source_port_range diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_route.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_route.py index 341db6e9f6ee..ac9961730be9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_route.py @@ -51,6 +51,7 @@ class EffectiveRoute(Model): } def __init__(self, name=None, source=None, state=None, address_prefix=None, next_hop_ip_address=None, next_hop_type=None): + super(EffectiveRoute, self).__init__() self.name = name self.source = source self.state = state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_route_list_result.py index cd6d46109e7d..19fc276c68de 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_route_list_result.py @@ -27,5 +27,6 @@ class EffectiveRouteListResult(Model): } def __init__(self, value=None, next_link=None): + super(EffectiveRouteListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/error.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/error.py index 3761940c6d48..a8cfeb4db72d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/error.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/error.py @@ -36,6 +36,7 @@ class Error(Model): } def __init__(self, code=None, message=None, target=None, details=None, inner_error=None): + super(Error, self).__init__() self.code = code self.message = message self.target = target diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/error_details.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/error_details.py index 47f2ac4111b1..40bea00aa2fb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/error_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/error_details.py @@ -30,6 +30,7 @@ class ErrorDetails(Model): } def __init__(self, code=None, target=None, message=None): + super(ErrorDetails, self).__init__() self.code = code self.target = target self.message = message diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_arp_table.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_arp_table.py index a2f8f716bf8a..ace325747ee5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_arp_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_arp_table.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitArpTable(Model): } def __init__(self, age=None, interface=None, ip_address=None, mac_address=None): + super(ExpressRouteCircuitArpTable, self).__init__() self.age = age self.interface = interface self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_peering_config.py index 3100d6605745..919ec6fac9ea 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_peering_config.py @@ -39,6 +39,7 @@ class ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, advertised_public_prefixes=None, advertised_public_prefixes_state=None, customer_asn=None, routing_registry_name=None): + super(ExpressRouteCircuitPeeringConfig, self).__init__() self.advertised_public_prefixes = advertised_public_prefixes self.advertised_public_prefixes_state = advertised_public_prefixes_state self.customer_asn = customer_asn diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_routes_table.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_routes_table.py index e84fae6e0973..804d29a2f9bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_routes_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_routes_table.py @@ -36,6 +36,7 @@ class ExpressRouteCircuitRoutesTable(Model): } def __init__(self, network=None, next_hop=None, loc_prf=None, weight=None, path=None): + super(ExpressRouteCircuitRoutesTable, self).__init__() self.network = network self.next_hop = next_hop self.loc_prf = loc_prf diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_routes_table_summary.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_routes_table_summary.py index 3ff1b42d0c1b..6f5f89764dd4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_routes_table_summary.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_routes_table_summary.py @@ -38,6 +38,7 @@ class ExpressRouteCircuitRoutesTableSummary(Model): } def __init__(self, neighbor=None, v=None, as_property=None, up_down=None, state_pfx_rcd=None): + super(ExpressRouteCircuitRoutesTableSummary, self).__init__() self.neighbor = neighbor self.v = v self.as_property = as_property diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_service_provider_properties.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_service_provider_properties.py index b7ada851e235..7a6b4ba96061 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_service_provider_properties.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_service_provider_properties.py @@ -30,6 +30,7 @@ class ExpressRouteCircuitServiceProviderProperties(Model): } def __init__(self, service_provider_name=None, peering_location=None, bandwidth_in_mbps=None): + super(ExpressRouteCircuitServiceProviderProperties, self).__init__() self.service_provider_name = service_provider_name self.peering_location = peering_location self.bandwidth_in_mbps = bandwidth_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_sku.py index dfb764a639bf..75ca393cc759 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_sku.py @@ -34,6 +34,7 @@ class ExpressRouteCircuitSku(Model): } def __init__(self, name=None, tier=None, family=None): + super(ExpressRouteCircuitSku, self).__init__() self.name = name self.tier = tier self.family = family diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_stats.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_stats.py index 1215bda40383..e26f6f7d2f74 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_stats.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuit_stats.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitStats(Model): } def __init__(self, primarybytes_in=None, primarybytes_out=None, secondarybytes_in=None, secondarybytes_out=None): + super(ExpressRouteCircuitStats, self).__init__() self.primarybytes_in = primarybytes_in self.primarybytes_out = primarybytes_out self.secondarybytes_in = secondarybytes_in diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_arp_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_arp_table_list_result.py index c7beab0fa31e..6957b4be6567 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_arp_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_arp_table_list_result.py @@ -28,5 +28,6 @@ class ExpressRouteCircuitsArpTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsArpTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_routes_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_routes_table_list_result.py index 4855bb3fb5a7..4758a6003be9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_routes_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_routes_table_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_routes_table_summary_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_routes_table_summary_list_result.py index 796391acdb71..3cc31a245073 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_routes_table_summary_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_circuits_routes_table_summary_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableSummaryListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableSummaryListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_service_provider_bandwidths_offered.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_service_provider_bandwidths_offered.py index b1b2c8a76447..9cbba2fcfe97 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_service_provider_bandwidths_offered.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/express_route_service_provider_bandwidths_offered.py @@ -27,5 +27,6 @@ class ExpressRouteServiceProviderBandwidthsOffered(Model): } def __init__(self, offer_name=None, value_in_mbps=None): + super(ExpressRouteServiceProviderBandwidthsOffered, self).__init__() self.offer_name = offer_name self.value_in_mbps = value_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/flow_log_information.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/flow_log_information.py index 3fdaed0dc09f..803f3ebc457e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/flow_log_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/flow_log_information.py @@ -42,6 +42,7 @@ class FlowLogInformation(Model): } def __init__(self, target_resource_id, storage_id, enabled, retention_policy=None): + super(FlowLogInformation, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/flow_log_status_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/flow_log_status_parameters.py index 1dae2ff24447..4cd22222bb45 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/flow_log_status_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/flow_log_status_parameters.py @@ -29,4 +29,5 @@ class FlowLogStatusParameters(Model): } def __init__(self, target_resource_id): + super(FlowLogStatusParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/gateway_route.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/gateway_route.py index d3e0d4163c35..64a53f146c0b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/gateway_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/gateway_route.py @@ -55,6 +55,7 @@ class GatewayRoute(Model): } def __init__(self): + super(GatewayRoute, self).__init__() self.local_address = None self.network = None self.next_hop = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/gateway_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/gateway_route_list_result.py index 145f14b002d4..2048c697deba 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/gateway_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/gateway_route_list_result.py @@ -24,4 +24,5 @@ class GatewayRouteListResult(Model): } def __init__(self, value=None): + super(GatewayRouteListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ip_address_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ip_address_availability_result.py index 0e26dd91fffc..f2cb36a550ec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ip_address_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ip_address_availability_result.py @@ -28,5 +28,6 @@ class IPAddressAvailabilityResult(Model): } def __init__(self, available=None, available_ip_addresses=None): + super(IPAddressAvailabilityResult, self).__init__() self.available = available self.available_ip_addresses = available_ip_addresses diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ipsec_policy.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ipsec_policy.py index b373c94ae0d8..7bedbe15b8a3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ipsec_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ipsec_policy.py @@ -74,6 +74,7 @@ class IpsecPolicy(Model): } def __init__(self, sa_life_time_seconds, sa_data_size_kilobytes, ipsec_encryption, ipsec_integrity, ike_encryption, ike_integrity, dh_group, pfs_group): + super(IpsecPolicy, self).__init__() self.sa_life_time_seconds = sa_life_time_seconds self.sa_data_size_kilobytes = sa_data_size_kilobytes self.ipsec_encryption = ipsec_encryption diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ipv6_express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ipv6_express_route_circuit_peering_config.py index 6386f9b728e9..eacc812d3043 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ipv6_express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/ipv6_express_route_circuit_peering_config.py @@ -39,6 +39,7 @@ class Ipv6ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, primary_peer_address_prefix=None, secondary_peer_address_prefix=None, microsoft_peering_config=None, route_filter=None, state=None): + super(Ipv6ExpressRouteCircuitPeeringConfig, self).__init__() self.primary_peer_address_prefix = primary_peer_address_prefix self.secondary_peer_address_prefix = secondary_peer_address_prefix self.microsoft_peering_config = microsoft_peering_config diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/network_interface_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/network_interface_association.py index c444e9cf432f..f9b3c3ad734c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/network_interface_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/network_interface_association.py @@ -35,5 +35,6 @@ class NetworkInterfaceAssociation(Model): } def __init__(self, security_rules=None): + super(NetworkInterfaceAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/network_interface_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/network_interface_dns_settings.py index 110594c2f928..675a4a1eb08a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/network_interface_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/network_interface_dns_settings.py @@ -47,6 +47,7 @@ class NetworkInterfaceDnsSettings(Model): } def __init__(self, dns_servers=None, applied_dns_servers=None, internal_dns_name_label=None, internal_fqdn=None, internal_domain_name_suffix=None): + super(NetworkInterfaceDnsSettings, self).__init__() self.dns_servers = dns_servers self.applied_dns_servers = applied_dns_servers self.internal_dns_name_label = internal_dns_name_label diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/next_hop_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/next_hop_parameters.py index f38a8ce62abb..3e1478409a0a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/next_hop_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/next_hop_parameters.py @@ -42,6 +42,7 @@ class NextHopParameters(Model): } def __init__(self, target_resource_id, source_ip_address, destination_ip_address, target_nic_resource_id=None): + super(NextHopParameters, self).__init__() self.target_resource_id = target_resource_id self.source_ip_address = source_ip_address self.destination_ip_address = destination_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/next_hop_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/next_hop_result.py index ffc8f99a05e5..bdbf28159eba 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/next_hop_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/next_hop_result.py @@ -36,6 +36,7 @@ class NextHopResult(Model): } def __init__(self, next_hop_type=None, next_hop_ip_address=None, route_table_id=None): + super(NextHopResult, self).__init__() self.next_hop_type = next_hop_type self.next_hop_ip_address = next_hop_ip_address self.route_table_id = route_table_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture.py index c2526c515377..b732a96612d0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture.py @@ -50,6 +50,7 @@ class PacketCapture(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCapture, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_filter.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_filter.py index 36a322e17e40..781b00a9a70a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_filter.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_filter.py @@ -52,6 +52,7 @@ class PacketCaptureFilter(Model): } def __init__(self, protocol="Any", local_ip_address=None, remote_ip_address=None, local_port=None, remote_port=None): + super(PacketCaptureFilter, self).__init__() self.protocol = protocol self.local_ip_address = local_ip_address self.remote_ip_address = remote_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_parameters.py index c140e9f2e176..69b68ea4d3ff 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_parameters.py @@ -50,6 +50,7 @@ class PacketCaptureParameters(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCaptureParameters, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_query_status_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_query_status_result.py index ba1e0dc9229b..3d6779ce0d67 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_query_status_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_query_status_result.py @@ -44,6 +44,7 @@ class PacketCaptureQueryStatusResult(Model): } def __init__(self, name=None, id=None, capture_start_time=None, packet_capture_status=None, stop_reason=None, packet_capture_error=None): + super(PacketCaptureQueryStatusResult, self).__init__() self.name = name self.id = id self.capture_start_time = capture_start_time diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_result.py index 36034bf4b263..68d818972f82 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_result.py @@ -71,6 +71,7 @@ class PacketCaptureResult(Model): } def __init__(self, target, storage_location, etag="A unique read-only string that changes whenever the resource is updated.", bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None, provisioning_state=None): + super(PacketCaptureResult, self).__init__() self.name = None self.id = None self.etag = etag diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_storage_location.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_storage_location.py index d0987d11ff9f..773b04d22501 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_storage_location.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/packet_capture_storage_location.py @@ -36,6 +36,7 @@ class PacketCaptureStorageLocation(Model): } def __init__(self, storage_id=None, storage_path=None, file_path=None): + super(PacketCaptureStorageLocation, self).__init__() self.storage_id = storage_id self.storage_path = storage_path self.file_path = file_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/public_ip_address_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/public_ip_address_dns_settings.py index 65a534407848..a248461f05d7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/public_ip_address_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/public_ip_address_dns_settings.py @@ -39,6 +39,7 @@ class PublicIPAddressDnsSettings(Model): } def __init__(self, domain_name_label=None, fqdn=None, reverse_fqdn=None): + super(PublicIPAddressDnsSettings, self).__init__() self.domain_name_label = domain_name_label self.fqdn = fqdn self.reverse_fqdn = reverse_fqdn diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/query_troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/query_troubleshooting_parameters.py index a394b181fcc5..9b6801eb7b63 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/query_troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/query_troubleshooting_parameters.py @@ -29,4 +29,5 @@ class QueryTroubleshootingParameters(Model): } def __init__(self, target_resource_id): + super(QueryTroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/resource.py index 994440bac861..5dfb000318bf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/resource.py @@ -44,6 +44,7 @@ class Resource(Model): } def __init__(self, id=None, location=None, tags=None): + super(Resource, self).__init__() self.id = id self.name = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/retention_policy_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/retention_policy_parameters.py index 58f7f12cc6a9..102f4c5c3b4c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/retention_policy_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/retention_policy_parameters.py @@ -27,5 +27,6 @@ class RetentionPolicyParameters(Model): } def __init__(self, days=0, enabled=False): + super(RetentionPolicyParameters, self).__init__() self.days = days self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_network_interface.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_network_interface.py index d674acd12cae..b087e727a80c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_network_interface.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_network_interface.py @@ -28,5 +28,6 @@ class SecurityGroupNetworkInterface(Model): } def __init__(self, id=None, security_rule_associations=None): + super(SecurityGroupNetworkInterface, self).__init__() self.id = id self.security_rule_associations = security_rule_associations diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_view_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_view_parameters.py index 304908dd4792..5c0972e5d55e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_view_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_view_parameters.py @@ -28,4 +28,5 @@ class SecurityGroupViewParameters(Model): } def __init__(self, target_resource_id): + super(SecurityGroupViewParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_view_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_view_result.py index dd0886dbef29..2fa7b25fef4e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_view_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_group_view_result.py @@ -25,4 +25,5 @@ class SecurityGroupViewResult(Model): } def __init__(self, network_interfaces=None): + super(SecurityGroupViewResult, self).__init__() self.network_interfaces = network_interfaces diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_rule_associations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_rule_associations.py index b582cadecee7..68093e1e8821 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_rule_associations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/security_rule_associations.py @@ -38,6 +38,7 @@ class SecurityRuleAssociations(Model): } def __init__(self, network_interface_association=None, subnet_association=None, default_security_rules=None, effective_security_rules=None): + super(SecurityRuleAssociations, self).__init__() self.network_interface_association = network_interface_association self.subnet_association = subnet_association self.default_security_rules = default_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/sub_resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/sub_resource.py index e7fa13135e83..d4a564864add 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/sub_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/sub_resource.py @@ -24,4 +24,5 @@ class SubResource(Model): } def __init__(self, id=None): + super(SubResource, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/subnet_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/subnet_association.py index 780068ceee4e..db77fe80faad 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/subnet_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/subnet_association.py @@ -35,5 +35,6 @@ class SubnetAssociation(Model): } def __init__(self, security_rules=None): + super(SubnetAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology.py index b39ffe945810..a04a9719a4c6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology.py @@ -44,6 +44,7 @@ class Topology(Model): } def __init__(self, resources=None): + super(Topology, self).__init__() self.id = None self.created_date_time = None self.last_modified = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_association.py index 51ac8d1d3a56..c22998da23f2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_association.py @@ -34,6 +34,7 @@ class TopologyAssociation(Model): } def __init__(self, name=None, resource_id=None, association_type=None): + super(TopologyAssociation, self).__init__() self.name = name self.resource_id = resource_id self.association_type = association_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_parameters.py index c2f674cad7fc..04920dc9665d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_parameters.py @@ -29,4 +29,5 @@ class TopologyParameters(Model): } def __init__(self, target_resource_group_name): + super(TopologyParameters, self).__init__() self.target_resource_group_name = target_resource_group_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_resource.py index 79ccf41dd45e..d79800ffcdc7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_resource.py @@ -35,6 +35,7 @@ class TopologyResource(Model): } def __init__(self, name=None, id=None, location=None, associations=None): + super(TopologyResource, self).__init__() self.name = name self.id = id self.location = location diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_details.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_details.py index 77ed12ff73b4..057c4a25216f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_details.py @@ -37,6 +37,7 @@ class TroubleshootingDetails(Model): } def __init__(self, id=None, reason_type=None, summary=None, detail=None, recommended_actions=None): + super(TroubleshootingDetails, self).__init__() self.id = id self.reason_type = reason_type self.summary = summary diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_parameters.py index d6bd7ebe04e6..c4833fb8eeb3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_parameters.py @@ -38,6 +38,7 @@ class TroubleshootingParameters(Model): } def __init__(self, target_resource_id, storage_id, storage_path): + super(TroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.storage_path = storage_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_recommended_actions.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_recommended_actions.py index 479eb32b8fa8..cbc5e31177c7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_recommended_actions.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_recommended_actions.py @@ -35,6 +35,7 @@ class TroubleshootingRecommendedActions(Model): } def __init__(self, action_id=None, action_text=None, action_uri=None, action_uri_text=None): + super(TroubleshootingRecommendedActions, self).__init__() self.action_id = action_id self.action_text = action_text self.action_uri = action_uri diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_result.py index 042e5515abbf..328f46d80e31 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/troubleshooting_result.py @@ -34,6 +34,7 @@ class TroubleshootingResult(Model): } def __init__(self, start_time=None, end_time=None, code=None, results=None): + super(TroubleshootingResult, self).__init__() self.start_time = start_time self.end_time = end_time self.code = code diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/tunnel_connection_health.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/tunnel_connection_health.py index 215e8273d85f..013e8abf31a4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/tunnel_connection_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/tunnel_connection_health.py @@ -53,6 +53,7 @@ class TunnelConnectionHealth(Model): } def __init__(self): + super(TunnelConnectionHealth, self).__init__() self.tunnel = None self.connection_status = None self.ingress_bytes_transferred = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/usage.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/usage.py index 2faac6e21cbd..2582daae4dcc 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/usage.py @@ -46,6 +46,7 @@ class Usage(Model): unit = "Count" def __init__(self, current_value, limit, name): + super(Usage, self).__init__() self.current_value = current_value self.limit = limit self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/usage_name.py index 87786b60cf62..df7f344bfb9b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/usage_name.py @@ -27,5 +27,6 @@ class UsageName(Model): } def __init__(self, value=None, localized_value=None): + super(UsageName, self).__init__() self.value = value self.localized_value = localized_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/verification_ip_flow_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/verification_ip_flow_parameters.py index 64a498fa4fda..f6f436c1ad60 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/verification_ip_flow_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/verification_ip_flow_parameters.py @@ -66,6 +66,7 @@ class VerificationIPFlowParameters(Model): } def __init__(self, target_resource_id, direction, protocol, local_port, remote_port, local_ip_address, remote_ip_address, target_nic_resource_id=None): + super(VerificationIPFlowParameters, self).__init__() self.target_resource_id = target_resource_id self.direction = direction self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/verification_ip_flow_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/verification_ip_flow_result.py index 4c4d81d0e198..9cd06048a358 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/verification_ip_flow_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/verification_ip_flow_result.py @@ -29,5 +29,6 @@ class VerificationIPFlowResult(Model): } def __init__(self, access=None, rule_name=None): + super(VerificationIPFlowResult, self).__init__() self.access = access self.rule_name = rule_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_gateway_sku.py index e1d1112cf052..c1a7139dce00 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_gateway_sku.py @@ -36,6 +36,7 @@ class VirtualNetworkGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(VirtualNetworkGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_usage.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_usage.py index 37f739a414ca..512ae10790e0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_usage.py @@ -48,6 +48,7 @@ class VirtualNetworkUsage(Model): } def __init__(self): + super(VirtualNetworkUsage, self).__init__() self.current_value = None self.id = None self.limit = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_usage_name.py index dd93c0846a5c..01fcbf0875eb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_usage_name.py @@ -35,5 +35,6 @@ class VirtualNetworkUsageName(Model): } def __init__(self): + super(VirtualNetworkUsageName, self).__init__() self.localized_value = None self.value = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/vpn_client_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/vpn_client_configuration.py index 8d58d30d38e5..a008ff357486 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/vpn_client_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/vpn_client_configuration.py @@ -36,6 +36,7 @@ class VpnClientConfiguration(Model): } def __init__(self, vpn_client_address_pool=None, vpn_client_root_certificates=None, vpn_client_revoked_certificates=None): + super(VpnClientConfiguration, self).__init__() self.vpn_client_address_pool = vpn_client_address_pool self.vpn_client_root_certificates = vpn_client_root_certificates self.vpn_client_revoked_certificates = vpn_client_revoked_certificates diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/vpn_client_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/vpn_client_parameters.py index b8e259be35db..57fcd9146f10 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/vpn_client_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/vpn_client_parameters.py @@ -30,4 +30,5 @@ class VpnClientParameters(Model): } def __init__(self, processor_architecture): + super(VpnClientParameters, self).__init__() self.processor_architecture = processor_architecture diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/network_management_client.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/network_management_client.py index fa9ef6e707cc..0c398e6d1586 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/network_management_client.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/network_management_client.py @@ -252,7 +252,7 @@ def check_dns_name_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/application_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/application_gateways_operations.py index fd7e9e3a9f16..bd790aa4bb47 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/application_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/application_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param parameters: Parameters supplied to the create or update - application gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.ApplicationGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ApplicationGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ApplicationGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update + application gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.ApplicationGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ApplicationGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('ApplicationGateway', response) + deserialized = self._deserialize('ApplicationGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -381,7 +431,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -400,23 +450,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def start( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Starts the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _start_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start' path_format_arguments = { @@ -441,18 +477,58 @@ def start( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 start( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Starts the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._start_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -465,10 +541,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -476,23 +548,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Stops the specified application gateway in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop' path_format_arguments = { @@ -517,18 +575,58 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def stop( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Stops the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -541,10 +639,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -552,28 +646,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def backend_health( - self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Gets the backend health of the specified application gateway in a - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param expand: Expands BackendAddressPool and BackendHttpSettings - referenced in backend health. - :type expand: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGatewayBackendHealth or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ApplicationGatewayBackendHealth] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _backend_health_initial( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth' path_format_arguments = { @@ -600,18 +675,71 @@ def backend_health( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ApplicationGatewayBackendHealth', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def backend_health( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets the backend health of the specified application gateway in a + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param expand: Expands BackendAddressPool and BackendHttpSettings + referenced in backend health. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGatewayBackendHealth or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ApplicationGatewayBackendHealth] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._backend_health_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + expand=expand, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -620,10 +748,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) + deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -631,10 +756,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -681,7 +802,7 @@ def list_available_waf_rule_sets( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/bgp_service_communities_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/bgp_service_communities_operations.py index a7929a7c46a0..2c1c895f9830 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/bgp_service_communities_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/bgp_service_communities_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuit_authorizations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuit_authorizations_operations.py index 07d10f9d164c..b7b3159990a2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuit_authorizations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuit_authorizations_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified authorization from the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified authorization from the specified express route + circuit. - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,31 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an authorization in the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param authorization_parameters: Parameters supplied to the create or - update express route circuit authorization operation. - :type authorization_parameters: - ~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitAuthorization - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitAuthorization] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -238,19 +240,78 @@ def create_or_update( body_content = self._serialize.body(authorization_parameters, 'ExpressRouteCircuitAuthorization') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization in the specified express route + circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or + update express route circuit authorization operation. + :type authorization_parameters: + ~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitAuthorization + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitAuthorization] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + authorization_parameters=authorization_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -259,12 +320,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -272,10 +328,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuit_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuit_peerings_operations.py index 14b255b7bac2..921319db48e7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuit_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuit_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified peering from the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified peering from the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified express route circuits. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param peering_parameters: Parameters supplied to the create or update - express route circuit peering operation. - :type peering_parameters: - ~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(peering_parameters, 'ExpressRouteCircuitPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + express route circuit peering operation. + :type peering_parameters: + ~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + peering_parameters=peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuits_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuits_operations.py index 511d80151ee2..4325be483d6b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuits_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_circuits_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the circuit. - :type circuit_name: str - :param parameters: Parameters supplied to the create or update express - route circuit operation. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuit - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuit or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuit] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ExpressRouteCircuit') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuit', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuit', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the circuit. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express + route circuit operation. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuit + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuit or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuit] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuit', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuit', response) + deserialized = self._deserialize('ExpressRouteCircuit', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -269,30 +319,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_arp_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised ARP table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsArpTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitsArpTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_arp_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}' path_format_arguments = { @@ -319,18 +348,74 @@ def list_arp_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ExpressRouteCircuitsArpTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_arp_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised ARP table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsArpTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitsArpTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_arp_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -339,10 +424,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -350,10 +432,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -361,30 +439,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitsRoutesTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}' path_format_arguments = { @@ -411,18 +468,74 @@ def list_routes_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsRoutesTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitsRoutesTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -431,10 +544,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -442,10 +552,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -453,30 +559,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table_summary( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table summary associated with the - express route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse - if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_summary_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}' path_format_arguments = { @@ -503,18 +588,74 @@ def list_routes_table_summary( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table_summary( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table summary associated with the + express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse + if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -523,10 +664,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -534,10 +672,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -589,7 +723,7 @@ def get_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -654,7 +788,7 @@ def get_peering_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -720,7 +854,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -784,7 +918,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_service_providers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_service_providers_operations.py index 11fb1cf52fa1..56632a1f965b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_service_providers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/express_route_service_providers_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/load_balancers_operations.py index 4dae4a441a9e..821a16731734 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/load_balancers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param parameters: Parameters supplied to the create or update load - balancer operation. - :type parameters: ~azure.mgmt.network.v2017_03_01.models.LoadBalancer - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns LoadBalancer - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.LoadBalancer] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LoadBalancer') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LoadBalancer', response) + if response.status_code == 201: + deserialized = self._deserialize('LoadBalancer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load + balancer operation. + :type parameters: ~azure.mgmt.network.v2017_03_01.models.LoadBalancer + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns LoadBalancer + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.LoadBalancer] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LoadBalancer', response) - if response.status_code == 201: - deserialized = self._deserialize('LoadBalancer', response) + deserialized = self._deserialize('LoadBalancer', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/local_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/local_network_gateways_operations.py index a6d2cfb9bd32..35269a7aa139 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/local_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/local_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a local network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param parameters: Parameters supplied to the create or update local - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.LocalNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - LocalNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.LocalNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LocalNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocalNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('LocalNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a local network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.LocalNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + LocalNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.LocalNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LocalNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('LocalNetworkGateway', response) + deserialized = self._deserialize('LocalNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified local network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified local network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_interfaces_operations.py index 111cf79065db..934f82ce8c1d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_interfaces_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -36,23 +37,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-03-01" # Construct URL @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,28 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param parameters: Parameters supplied to the create or update network - interface operation. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.NetworkInterface - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkInterface or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.NetworkInterface] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2017-03-01" # Construct URL @@ -232,19 +236,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkInterface') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkInterface', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkInterface', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network + interface operation. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.NetworkInterface + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkInterface or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.NetworkInterface] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkInterface', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkInterface', response) + deserialized = self._deserialize('NetworkInterface', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -324,7 +374,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -393,7 +443,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -412,24 +462,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def get_effective_route_table( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all route tables applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.EffectiveRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_effective_route_table_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-03-01" # Construct URL @@ -456,18 +491,66 @@ def get_effective_route_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_effective_route_table( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all route tables applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.EffectiveRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_effective_route_table_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -476,10 +559,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveRouteListResult', response) + deserialized = self._deserialize('EffectiveRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -487,10 +567,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -498,25 +574,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_effective_network_security_groups( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all network security groups applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveNetworkSecurityGroupListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.EffectiveNetworkSecurityGroupListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_effective_network_security_groups_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-03-01" # Construct URL @@ -543,18 +603,67 @@ def list_effective_network_security_groups( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveNetworkSecurityGroupListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_effective_network_security_groups( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all network security groups applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveNetworkSecurityGroupListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.EffectiveNetworkSecurityGroupListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_effective_network_security_groups_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -563,10 +672,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) + deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -574,10 +680,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -643,7 +745,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -716,7 +818,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -791,7 +893,7 @@ def get_virtual_machine_scale_set_network_interface( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_security_groups_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_security_groups_operations.py index 4087a4e96599..8691b1d3a709 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_security_groups_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_security_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,24 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -80,18 +66,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def delete( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -104,10 +131,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network security group in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param parameters: Parameters supplied to the create or update network - security group operation. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.NetworkSecurityGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.NetworkSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -232,19 +234,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkSecurityGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network security group in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network + security group operation. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.NetworkSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.NetworkSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkSecurityGroup', response) + deserialized = self._deserialize('NetworkSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -322,7 +372,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -389,7 +439,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_watchers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_watchers_operations.py index d82f03c23fc4..2a02978443c1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_watchers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/network_watchers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -152,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -170,23 +171,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network watcher resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}' path_format_arguments = { @@ -211,18 +198,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network watcher resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -235,10 +262,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -294,7 +317,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -358,7 +381,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -429,7 +452,7 @@ def get_topology( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -447,28 +470,9 @@ def get_topology( return deserialized - def verify_ip_flow( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Verify IP flow from the specified VM to a location given the currently - configured NSG rules. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the IP flow to be verified. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.VerificationIPFlowParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VerificationIPFlowResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VerificationIPFlowResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _verify_ip_flow_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify' path_format_arguments = { @@ -496,19 +500,74 @@ def verify_ip_flow( body_content = self._serialize.body(parameters, 'VerificationIPFlowParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('VerificationIPFlowResult', response) + if response.status_code == 202: + deserialized = self._deserialize('VerificationIPFlowResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def verify_ip_flow( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Verify IP flow from the specified VM to a location given the currently + configured NSG rules. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.VerificationIPFlowParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VerificationIPFlowResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VerificationIPFlowResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._verify_ip_flow_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -517,12 +576,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VerificationIPFlowResult', response) - if response.status_code == 202: - deserialized = self._deserialize('VerificationIPFlowResult', response) + deserialized = self._deserialize('VerificationIPFlowResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -530,10 +584,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -541,28 +591,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_next_hop( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Gets the next hop from the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the source and destination - endpoint. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.NextHopParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NextHopResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.NextHopResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_next_hop_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop' path_format_arguments = { @@ -590,19 +621,74 @@ def get_next_hop( body_content = self._serialize.body(parameters, 'NextHopParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('NextHopResult', response) + if response.status_code == 202: + deserialized = self._deserialize('NextHopResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_next_hop( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination + endpoint. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.NextHopParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NextHopResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.NextHopResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_next_hop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -611,12 +697,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NextHopResult', response) - if response.status_code == 202: - deserialized = self._deserialize('NextHopResult', response) + deserialized = self._deserialize('NextHopResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -624,10 +705,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -635,27 +712,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_vm_security_rules( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Gets the configured and effective security group rules on the specified - VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param target_resource_id: ID of the target VM. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - SecurityGroupViewResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.SecurityGroupViewResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_vm_security_rules_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.SecurityGroupViewParameters(target_resource_id=target_resource_id) # Construct URL @@ -685,19 +744,73 @@ def get_vm_security_rules( body_content = self._serialize.body(parameters, 'SecurityGroupViewParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('SecurityGroupViewResult', response) + if response.status_code == 202: + deserialized = self._deserialize('SecurityGroupViewResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_vm_security_rules( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the configured and effective security group rules on the specified + VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param target_resource_id: ID of the target VM. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + SecurityGroupViewResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.SecurityGroupViewResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_vm_security_rules_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -706,12 +819,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityGroupViewResult', response) - if response.status_code == 202: - deserialized = self._deserialize('SecurityGroupViewResult', response) + deserialized = self._deserialize('SecurityGroupViewResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -719,10 +827,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -730,28 +834,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Initiate troubleshooting on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the resource to - troubleshoot. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.TroubleshootingParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot' path_format_arguments = { @@ -779,19 +864,74 @@ def get_troubleshooting( body_content = self._serialize.body(parameters, 'TroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to + troubleshoot. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.TroubleshootingParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -800,12 +940,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -813,10 +948,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -824,27 +955,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting_result( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Get the last completed troubleshooting result on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource ID to query the - troubleshooting result. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_result_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.QueryTroubleshootingParameters(target_resource_id=target_resource_id) # Construct URL @@ -874,19 +987,73 @@ def get_troubleshooting_result( body_content = self._serialize.body(parameters, 'QueryTroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting_result( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource ID to query the + troubleshooting result. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_result_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -895,12 +1062,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -908,10 +1070,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -919,29 +1077,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_flow_log_configuration( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Configures flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the configuration of flow - log. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.FlowLogInformation - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_flow_log_configuration_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog' path_format_arguments = { @@ -969,19 +1107,75 @@ def set_flow_log_configuration( body_content = self._serialize.body(parameters, 'FlowLogInformation') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_flow_log_configuration( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Configures flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow + log. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.FlowLogInformation + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_flow_log_configuration_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -990,12 +1184,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1003,10 +1192,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1014,28 +1199,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_flow_log_status( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Queries status of flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource where getting the flow - logging status. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_flow_log_status_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.FlowLogStatusParameters(target_resource_id=target_resource_id) # Construct URL @@ -1065,19 +1231,74 @@ def get_flow_log_status( body_content = self._serialize.body(parameters, 'FlowLogStatusParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_flow_log_status( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Queries status of flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource where getting the flow + logging status. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_flow_log_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1086,12 +1307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1099,10 +1315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1110,33 +1322,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def check_connectivity( - self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): - """Verifies the possibility of establishing a direct TCP connection from a - virtual machine to a given endpoint including another VM or an - arbitrary remote server. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param source: - :type source: - ~azure.mgmt.network.v2017_03_01.models.ConnectivitySource - :param destination: - :type destination: - ~azure.mgmt.network.v2017_03_01.models.ConnectivityDestination - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectivityInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ConnectivityInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _check_connectivity_initial( + self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectivityParameters(source=source, destination=destination) # Construct URL @@ -1166,19 +1354,80 @@ def check_connectivity( body_content = self._serialize.body(parameters, 'ConnectivityParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectivityInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('ConnectivityInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def check_connectivity( + self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): + """Verifies the possibility of establishing a direct TCP connection from a + virtual machine to a given endpoint including another VM or an + arbitrary remote server. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param source: + :type source: + ~azure.mgmt.network.v2017_03_01.models.ConnectivitySource + :param destination: + :type destination: + ~azure.mgmt.network.v2017_03_01.models.ConnectivityDestination + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectivityInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ConnectivityInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._check_connectivity_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + source=source, + destination=destination, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1187,12 +1436,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectivityInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('ConnectivityInformation', response) + deserialized = self._deserialize('ConnectivityInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1200,10 +1444,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/packet_captures_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/packet_captures_operations.py index e0b2182a6ebb..7a50fa54d52f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/packet_captures_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/packet_captures_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,29 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create( - self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create and start a packet capture on the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param parameters: Parameters that define the create packet capture - operation. - :type parameters: ~azure.mgmt.network.v2017_03_01.models.PacketCapture - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.PacketCaptureResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -89,19 +70,74 @@ def create( body_content = self._serialize.body(parameters, 'PacketCapture') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('PacketCaptureResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture + operation. + :type parameters: ~azure.mgmt.network.v2017_03_01.models.PacketCapture + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.PacketCaptureResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,10 +146,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('PacketCaptureResult', response) + deserialized = self._deserialize('PacketCaptureResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -121,10 +154,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +207,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,25 +225,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -240,18 +253,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -264,10 +320,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -275,25 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Stops a specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop' path_format_arguments = { @@ -319,18 +355,61 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 stop( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Stops a specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +422,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -354,27 +429,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_status( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Query the status of a running packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the Network Watcher resource. - :type network_watcher_name: str - :param packet_capture_name: The name given to the packet capture - session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureQueryStatusResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.PacketCaptureQueryStatusResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_status_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus' path_format_arguments = { @@ -400,18 +457,72 @@ def get_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('PacketCaptureQueryStatusResult', response) + if response.status_code == 202: + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_status( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Query the status of a running packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param packet_capture_name: The name given to the packet capture + session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureQueryStatusResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.PacketCaptureQueryStatusResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -420,12 +531,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) - if response.status_code == 202: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -433,10 +539,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -495,7 +597,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/public_ip_addresses_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/public_ip_addresses_operations.py index 64c903dd555d..c6702a6ef40d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/public_ip_addresses_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/public_ip_addresses_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -36,23 +37,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the subnet. - :type public_ip_address_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-03-01" # Construct URL @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the subnet. + :type public_ip_address_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,28 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a static or dynamic public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the public IP address. - :type public_ip_address_name: str - :param parameters: Parameters supplied to the create or update public - IP address operation. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.PublicIPAddress - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PublicIPAddress or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.PublicIPAddress] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2017-03-01" # Construct URL @@ -232,19 +236,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'PublicIPAddress') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PublicIPAddress', response) + if response.status_code == 201: + deserialized = self._deserialize('PublicIPAddress', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public + IP address operation. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.PublicIPAddress + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PublicIPAddress or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.PublicIPAddress] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PublicIPAddress', response) - if response.status_code == 201: - deserialized = self._deserialize('PublicIPAddress', response) + deserialized = self._deserialize('PublicIPAddress', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -324,7 +374,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -393,7 +443,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -467,7 +517,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -550,7 +600,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -631,7 +681,7 @@ def get_virtual_machine_scale_set_public_ip_address( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_filter_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_filter_rules_operations.py index 7325b782958e..afbea3b6ec0d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_filter_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_filter_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified rule from a route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the rule. - :type rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified rule from a route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the create - or update route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2017_03_01.models.RouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -233,19 +236,77 @@ def create_or_update( body_content = self._serialize.body(route_filter_rule_parameters, 'RouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create + or update route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2017_03_01.models.RouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -254,12 +315,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -267,10 +323,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -278,30 +330,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the update - route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2017_03_01.models.PatchRouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -330,19 +361,75 @@ def update( body_content = self._serialize.body(route_filter_rule_parameters, 'PatchRouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the update + route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2017_03_01.models.PatchRouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -351,10 +438,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -362,10 +446,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -424,7 +504,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_filters_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_filters_operations.py index 4daa8bd4de35..b883f6be5f7b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_filters_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_filters_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the create or - update route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2017_03_01.models.RouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(route_filter_parameters, 'RouteFilter') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or + update route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2017_03_01.models.RouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,28 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the update - route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2017_03_01.models.PatchRouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -322,19 +353,72 @@ def update( body_content = self._serialize.body(route_filter_parameters, 'PatchRouteFilter') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the update + route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2017_03_01.models.PatchRouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +427,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -354,10 +435,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -413,7 +490,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -477,7 +554,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_tables_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_tables_operations.py index 9c2b81997e46..9c9d764d335e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_tables_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/route_tables_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create or updates a route table in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param parameters: Parameters supplied to the create or update route - table operation. - :type parameters: ~azure.mgmt.network.v2017_03_01.models.RouteTable - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteTable - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.RouteTable] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'RouteTable') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteTable', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route + table operation. + :type parameters: ~azure.mgmt.network.v2017_03_01.models.RouteTable + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteTable + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.RouteTable] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteTable', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteTable', response) + deserialized = self._deserialize('RouteTable', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -320,7 +370,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/routes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/routes_operations.py index cb6a2e782ecf..53c4b98177d9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/routes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/routes_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route from a route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route from a route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,29 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param route_parameters: Parameters supplied to the create or update - route operation. - :type route_parameters: ~azure.mgmt.network.v2017_03_01.models.Route - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Route or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.Route] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -232,19 +236,76 @@ def create_or_update( body_content = self._serialize.body(route_parameters, 'Route') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Route', response) + if response.status_code == 201: + deserialized = self._deserialize('Route', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update + route operation. + :type route_parameters: ~azure.mgmt.network.v2017_03_01.models.Route + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Route or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.Route] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + route_parameters=route_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +314,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Route', response) - if response.status_code == 201: - deserialized = self._deserialize('Route', response) + deserialized = self._deserialize('Route', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +322,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -328,7 +380,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/security_rules_operations.py index 636bf5642a04..87670cfecab5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/security_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,32 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a security rule in the specified network security - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param security_rule_parameters: Parameters supplied to the create or - update network security rule operation. - :type security_rule_parameters: - ~azure.mgmt.network.v2017_03_01.models.SecurityRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns SecurityRule - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.SecurityRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -237,19 +238,79 @@ def create_or_update( body_content = self._serialize.body(security_rule_parameters, 'SecurityRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SecurityRule', response) + if response.status_code == 201: + deserialized = self._deserialize('SecurityRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a security rule in the specified network security + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or + update network security rule operation. + :type security_rule_parameters: + ~azure.mgmt.network.v2017_03_01.models.SecurityRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns SecurityRule + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.SecurityRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + security_rule_parameters=security_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -258,12 +319,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityRule', response) - if response.status_code == 201: - deserialized = self._deserialize('SecurityRule', response) + deserialized = self._deserialize('SecurityRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -271,10 +327,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/subnets_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/subnets_operations.py index c65d9308a424..c6a65771833a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/subnets_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/subnets_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified subnet. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified subnet. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,29 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a subnet in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param subnet_parameters: Parameters supplied to the create or update - subnet operation. - :type subnet_parameters: ~azure.mgmt.network.v2017_03_01.models.Subnet - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Subnet or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.Subnet] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -236,19 +240,76 @@ def create_or_update( body_content = self._serialize.body(subnet_parameters, 'Subnet') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Subnet', response) + if response.status_code == 201: + deserialized = self._deserialize('Subnet', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update + subnet operation. + :type subnet_parameters: ~azure.mgmt.network.v2017_03_01.models.Subnet + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Subnet or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.Subnet] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subnet_parameters=subnet_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -257,12 +318,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Subnet', response) - if response.status_code == 201: - deserialized = self._deserialize('Subnet', response) + deserialized = self._deserialize('Subnet', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -270,10 +326,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -332,7 +384,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/usages_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/usages_operations.py index ecaba5010af9..08cdbf139a14 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/usages_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/usages_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_gateway_connections_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_gateway_connections_operations.py index 9f83dec9b192..52824c7da184 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_gateway_connections_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_gateway_connections_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway connection in the - specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param parameters: Parameters supplied to the create or update virtual - network gateway connection operation. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.VirtualNetworkGatewayConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGatewayConnection or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VirtualNetworkGatewayConnection] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGatewayConnection') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway connection in the + specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual + network gateway connection operation. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.VirtualNetworkGatewayConnection + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGatewayConnection or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VirtualNetworkGatewayConnection] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -181,7 +209,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -199,24 +227,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network Gateway connection. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -241,18 +254,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network Gateway connection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -265,10 +319,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -276,30 +326,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): - """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection name. - :type virtual_network_gateway_connection_name: str - :param value: The virtual network connection shared key value. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ConnectionSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionSharedKey(value=value) # Construct URL @@ -329,19 +358,76 @@ def set_shared_key( body_content = self._serialize.body(parameters, 'ConnectionSharedKey') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConnectionSharedKey', response) + if response.status_code == 201: + deserialized = self._deserialize('ConnectionSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection name. + :type virtual_network_gateway_connection_name: str + :param value: The virtual network connection shared key value. + :type value: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ConnectionSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + value=value, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -350,12 +436,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionSharedKey', response) - if response.status_code == 201: - deserialized = self._deserialize('ConnectionSharedKey', response) + deserialized = self._deserialize('ConnectionSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -363,10 +444,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -420,7 +497,7 @@ def get_shared_key( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -487,7 +564,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -506,31 +583,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): - """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection reset shared key Name. - :type virtual_network_gateway_connection_name: str - :param key_length: The virtual network connection reset shared key - length, should between 1 and 128. - :type key_length: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionResetSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ConnectionResetSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionResetSharedKey(key_length=key_length) # Construct URL @@ -560,19 +615,75 @@ def reset_shared_key( body_content = self._serialize.body(parameters, 'ConnectionResetSharedKey') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectionResetSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection reset shared key Name. + :type virtual_network_gateway_connection_name: str + :param key_length: The virtual network connection reset shared key + length, should between 1 and 128. + :type key_length: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionResetSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.ConnectionResetSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + key_length=key_length, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -581,10 +692,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionResetSharedKey', response) + deserialized = self._deserialize('ConnectionResetSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -592,10 +700,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_gateways_operations.py index 502a22c1f60c..606d25abc419 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to create or update virtual - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.VirtualNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.VirtualNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -340,29 +390,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset( - self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): - """Resets the primary of the virtual network gateway in the specified - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param gateway_vip: Virtual network gateway vip address supplied to - the begin reset of the active-active feature enabled gateway. - :type gateway_vip: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_initial( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset' path_format_arguments = { @@ -389,18 +419,72 @@ def reset( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): + """Resets the primary of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param gateway_vip: Virtual network gateway vip address supplied to + the begin reset of the active-active feature enabled gateway. + :type gateway_vip: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + gateway_vip=gateway_vip, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -409,10 +493,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -420,10 +501,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -486,7 +563,7 @@ def generatevpnclientpackage( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [202]: exp = CloudError(response) @@ -504,27 +581,9 @@ def generatevpnclientpackage( return deserialized - def get_bgp_peer_status( - self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): - """The GetBgpPeerStatus operation retrieves the status of all BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer to retrieve the status of. - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - BgpPeerStatusListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.BgpPeerStatusListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_bgp_peer_status_initial( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus' path_format_arguments = { @@ -551,18 +610,70 @@ def get_bgp_peer_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BgpPeerStatusListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_bgp_peer_status( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): + """The GetBgpPeerStatus operation retrieves the status of all BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer to retrieve the status of. + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + BgpPeerStatusListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.BgpPeerStatusListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_bgp_peer_status_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -571,10 +682,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BgpPeerStatusListResult', response) + deserialized = self._deserialize('BgpPeerStatusListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -582,10 +690,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -593,26 +697,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_learned_routes( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - has learned, including routes learned from BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_learned_routes_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes' path_format_arguments = { @@ -637,18 +724,68 @@ def get_learned_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_learned_routes( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + has learned, including routes learned from BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_learned_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -657,10 +794,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -668,10 +802,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -679,28 +809,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_advertised_routes( - self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - is advertising to the specified peer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_advertised_routes_initial( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes' path_format_arguments = { @@ -726,18 +837,71 @@ def get_advertised_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_advertised_routes( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + is advertising to the specified peer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_advertised_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -746,10 +910,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -757,10 +918,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_peerings_operations.py index 51a3bffd50d9..287827d65237 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network peering. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the virtual network - peering. - :type virtual_network_peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network + peering. + :type virtual_network_peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the peering. - :type virtual_network_peering_name: str - :param virtual_network_peering_parameters: Parameters supplied to the - create or update virtual network peering operation. - :type virtual_network_peering_parameters: - ~azure.mgmt.network.v2017_03_01.models.VirtualNetworkPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VirtualNetworkPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(virtual_network_peering_parameters, 'VirtualNetworkPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the + create or update virtual network peering operation. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2017_03_01.models.VirtualNetworkPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VirtualNetworkPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + virtual_network_peering_parameters=virtual_network_peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkPeering', response) + deserialized = self._deserialize('VirtualNetworkPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_networks_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_networks_operations.py index e4acd181db36..b57d5077adfe 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_networks_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_networks_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network in the specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to the create or update virtual - network operation - :type parameters: - ~azure.mgmt.network.v2017_03_01.models.VirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetwork or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VirtualNetwork] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetwork') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetwork', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual + network operation + :type parameters: + ~azure.mgmt.network.v2017_03_01.models.VirtualNetwork + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetwork or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_03_01.models.VirtualNetwork] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetwork', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetwork', response) + deserialized = self._deserialize('VirtualNetwork', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -452,7 +502,7 @@ def check_ip_address_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -521,7 +571,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/address_space.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/address_space.py index 4ff6fb3af6d8..d7050c78a457 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/address_space.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/address_space.py @@ -26,4 +26,5 @@ class AddressSpace(Model): } def __init__(self, address_prefixes=None): + super(AddressSpace, self).__init__() self.address_prefixes = address_prefixes diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_available_waf_rule_sets_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_available_waf_rule_sets_result.py index 1f5ccafe9e13..5b7bcef06010 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_available_waf_rule_sets_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_available_waf_rule_sets_result.py @@ -25,4 +25,5 @@ class ApplicationGatewayAvailableWafRuleSetsResult(Model): } def __init__(self, value=None): + super(ApplicationGatewayAvailableWafRuleSetsResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_address.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_address.py index 5ff5ce4b4a5c..6005027d0845 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_address.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_address.py @@ -27,5 +27,6 @@ class ApplicationGatewayBackendAddress(Model): } def __init__(self, fqdn=None, ip_address=None): + super(ApplicationGatewayBackendAddress, self).__init__() self.fqdn = fqdn self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health.py index 784d0de5b6b0..6c0a5cad5b56 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health.py @@ -25,4 +25,5 @@ class ApplicationGatewayBackendHealth(Model): } def __init__(self, backend_address_pools=None): + super(ApplicationGatewayBackendHealth, self).__init__() self.backend_address_pools = backend_address_pools diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_http_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_http_settings.py index b43ae8162eec..d7141d80e780 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_http_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_http_settings.py @@ -30,5 +30,6 @@ class ApplicationGatewayBackendHealthHttpSettings(Model): } def __init__(self, backend_http_settings=None, servers=None): + super(ApplicationGatewayBackendHealthHttpSettings, self).__init__() self.backend_http_settings = backend_http_settings self.servers = servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_pool.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_pool.py index 2abf579c60de..7a20b413b9a0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_pool.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_pool.py @@ -31,5 +31,6 @@ class ApplicationGatewayBackendHealthPool(Model): } def __init__(self, backend_address_pool=None, backend_http_settings_collection=None): + super(ApplicationGatewayBackendHealthPool, self).__init__() self.backend_address_pool = backend_address_pool self.backend_http_settings_collection = backend_http_settings_collection diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_server.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_server.py index fe99981f39d1..70c6119ec6c3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_server.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_health_server.py @@ -33,6 +33,7 @@ class ApplicationGatewayBackendHealthServer(Model): } def __init__(self, address=None, ip_configuration=None, health=None): + super(ApplicationGatewayBackendHealthServer, self).__init__() self.address = address self.ip_configuration = ip_configuration self.health = health diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_connection_draining.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_connection_draining.py index e1912ca67c62..8f9b88b571e2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_connection_draining.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_connection_draining.py @@ -35,5 +35,6 @@ class ApplicationGatewayConnectionDraining(Model): } def __init__(self, enabled, drain_timeout_in_sec): + super(ApplicationGatewayConnectionDraining, self).__init__() self.enabled = enabled self.drain_timeout_in_sec = drain_timeout_in_sec diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_disabled_rule_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_disabled_rule_group.py index cac1f2bd38e0..02c88980e857 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_disabled_rule_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_disabled_rule_group.py @@ -32,5 +32,6 @@ class ApplicationGatewayFirewallDisabledRuleGroup(Model): } def __init__(self, rule_group_name, rules=None): + super(ApplicationGatewayFirewallDisabledRuleGroup, self).__init__() self.rule_group_name = rule_group_name self.rules = rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_rule.py index 74db98eb4e23..f3f7da7cc11b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_rule.py @@ -31,5 +31,6 @@ class ApplicationGatewayFirewallRule(Model): } def __init__(self, rule_id, description=None): + super(ApplicationGatewayFirewallRule, self).__init__() self.rule_id = rule_id self.description = description diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_rule_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_rule_group.py index 6f68ebe349dd..b3ae90ab94b6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_rule_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_rule_group.py @@ -38,6 +38,7 @@ class ApplicationGatewayFirewallRuleGroup(Model): } def __init__(self, rule_group_name, rules, description=None): + super(ApplicationGatewayFirewallRuleGroup, self).__init__() self.rule_group_name = rule_group_name self.description = description self.rules = rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_probe_health_response_match.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_probe_health_response_match.py index 4c8ddb2c0896..beaef556eb99 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_probe_health_response_match.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_probe_health_response_match.py @@ -29,5 +29,6 @@ class ApplicationGatewayProbeHealthResponseMatch(Model): } def __init__(self, body=None, status_codes=None): + super(ApplicationGatewayProbeHealthResponseMatch, self).__init__() self.body = body self.status_codes = status_codes diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_sku.py index d7bff90f1619..61717b20136a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_sku.py @@ -35,6 +35,7 @@ class ApplicationGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(ApplicationGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_ssl_policy.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_ssl_policy.py index 86ea6ac13968..3d060d0e738d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_ssl_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_ssl_policy.py @@ -48,6 +48,7 @@ class ApplicationGatewaySslPolicy(Model): } def __init__(self, disabled_ssl_protocols=None, policy_type=None, policy_name=None, cipher_suites=None, min_protocol_version=None): + super(ApplicationGatewaySslPolicy, self).__init__() self.disabled_ssl_protocols = disabled_ssl_protocols self.policy_type = policy_type self.policy_name = policy_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_web_application_firewall_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_web_application_firewall_configuration.py index a82efaf4d293..c64a1549fd2b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_web_application_firewall_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_web_application_firewall_configuration.py @@ -47,6 +47,7 @@ class ApplicationGatewayWebApplicationFirewallConfiguration(Model): } def __init__(self, enabled, firewall_mode, rule_set_type, rule_set_version, disabled_rule_groups=None): + super(ApplicationGatewayWebApplicationFirewallConfiguration, self).__init__() self.enabled = enabled self.firewall_mode = firewall_mode self.rule_set_type = rule_set_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/azure_async_operation_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/azure_async_operation_result.py index 3f72f05c215b..60684d2b61e0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/azure_async_operation_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/azure_async_operation_result.py @@ -37,5 +37,6 @@ class AzureAsyncOperationResult(Model): } def __init__(self, status=None, error=None): + super(AzureAsyncOperationResult, self).__init__() self.status = status self.error = error diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_community.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_community.py index b80621009023..8275a0e4048c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_community.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_community.py @@ -43,6 +43,7 @@ class BGPCommunity(Model): } def __init__(self, service_supported_region=None, community_name=None, community_value=None, community_prefixes=None, is_authorized_to_use=None, service_group=None): + super(BGPCommunity, self).__init__() self.service_supported_region = service_supported_region self.community_name = community_name self.community_value = community_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_peer_status.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_peer_status.py index 26f9ca4e0e02..52f0333d8c6f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_peer_status.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_peer_status.py @@ -60,6 +60,7 @@ class BgpPeerStatus(Model): } def __init__(self): + super(BgpPeerStatus, self).__init__() self.local_address = None self.neighbor = None self.asn = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_peer_status_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_peer_status_list_result.py index 6946056ae3aa..05f737e85546 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_peer_status_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_peer_status_list_result.py @@ -24,4 +24,5 @@ class BgpPeerStatusListResult(Model): } def __init__(self, value=None): + super(BgpPeerStatusListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_settings.py index d62cc30ab0c7..c5730da2e43e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_settings.py @@ -32,6 +32,7 @@ class BgpSettings(Model): } def __init__(self, asn=None, bgp_peering_address=None, peer_weight=None): + super(BgpSettings, self).__init__() self.asn = asn self.bgp_peering_address = bgp_peering_address self.peer_weight = peer_weight diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connection_reset_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connection_reset_shared_key.py index 10bfdc9ba17d..3338112a7fe7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connection_reset_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connection_reset_shared_key.py @@ -29,4 +29,5 @@ class ConnectionResetSharedKey(Model): } def __init__(self, key_length): + super(ConnectionResetSharedKey, self).__init__() self.key_length = key_length diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connection_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connection_shared_key.py index 0dbbc36cc798..2c1b0ed9a914 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connection_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connection_shared_key.py @@ -28,4 +28,5 @@ class ConnectionSharedKey(Model): } def __init__(self, value): + super(ConnectionSharedKey, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_destination.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_destination.py index 756dfadfdd49..cd0e8818b591 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_destination.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_destination.py @@ -32,6 +32,7 @@ class ConnectivityDestination(Model): } def __init__(self, resource_id=None, address=None, port=None): + super(ConnectivityDestination, self).__init__() self.resource_id = resource_id self.address = address self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_hop.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_hop.py index 1aa5aaad010e..04510362b420 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_hop.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_hop.py @@ -52,6 +52,7 @@ class ConnectivityHop(Model): } def __init__(self): + super(ConnectivityHop, self).__init__() self.type = None self.id = None self.address = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_information.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_information.py index d93621ee7874..cfe924e93bdf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_information.py @@ -58,6 +58,7 @@ class ConnectivityInformation(Model): } def __init__(self): + super(ConnectivityInformation, self).__init__() self.hops = None self.connection_status = None self.avg_latency_in_ms = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_issue.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_issue.py index d0d3e6418cfa..588fbe4636e1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_issue.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_issue.py @@ -48,6 +48,7 @@ class ConnectivityIssue(Model): } def __init__(self): + super(ConnectivityIssue, self).__init__() self.origin = None self.severity = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_parameters.py index 6a655bd75743..704e22a98cf9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_parameters.py @@ -33,5 +33,6 @@ class ConnectivityParameters(Model): } def __init__(self, source, destination): + super(ConnectivityParameters, self).__init__() self.source = source self.destination = destination diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_source.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_source.py index 8c7034e63c32..c42bfc0aa09d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_source.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/connectivity_source.py @@ -33,5 +33,6 @@ class ConnectivitySource(Model): } def __init__(self, resource_id, port=None): + super(ConnectivitySource, self).__init__() self.resource_id = resource_id self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/dhcp_options.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/dhcp_options.py index 2262eb5ec2f1..8744ba6fc9b1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/dhcp_options.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/dhcp_options.py @@ -26,4 +26,5 @@ class DhcpOptions(Model): } def __init__(self, dns_servers=None): + super(DhcpOptions, self).__init__() self.dns_servers = dns_servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/dns_name_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/dns_name_availability_result.py index 4be1851d2f59..15a0238e49a7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/dns_name_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/dns_name_availability_result.py @@ -24,4 +24,5 @@ class DnsNameAvailabilityResult(Model): } def __init__(self, available=None): + super(DnsNameAvailabilityResult, self).__init__() self.available = available diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group.py index 554a47bc8029..9a4377adefba 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group.py @@ -38,6 +38,7 @@ class EffectiveNetworkSecurityGroup(Model): } def __init__(self, network_security_group=None, association=None, effective_security_rules=None, tag_map=None): + super(EffectiveNetworkSecurityGroup, self).__init__() self.network_security_group = network_security_group self.association = association self.effective_security_rules = effective_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group_association.py index f3f0449f1e59..8beaa4816477 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group_association.py @@ -28,5 +28,6 @@ class EffectiveNetworkSecurityGroupAssociation(Model): } def __init__(self, subnet=None, network_interface=None): + super(EffectiveNetworkSecurityGroupAssociation, self).__init__() self.subnet = subnet self.network_interface = network_interface diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group_list_result.py index 915011b0d4ef..0880178b82c7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_group_list_result.py @@ -35,5 +35,6 @@ class EffectiveNetworkSecurityGroupListResult(Model): } def __init__(self, value=None): + super(EffectiveNetworkSecurityGroupListResult, self).__init__() self.value = value self.next_link = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_rule.py index e8ba2c3660aa..8982b9d66c6b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_network_security_rule.py @@ -83,6 +83,7 @@ class EffectiveNetworkSecurityRule(Model): } def __init__(self, name=None, protocol=None, source_port_range=None, destination_port_range=None, source_port_ranges=None, destination_port_ranges=None, source_address_prefix=None, destination_address_prefix=None, source_address_prefixes=None, destination_address_prefixes=None, expanded_source_address_prefix=None, expanded_destination_address_prefix=None, access=None, priority=None, direction=None): + super(EffectiveNetworkSecurityRule, self).__init__() self.name = name self.protocol = protocol self.source_port_range = source_port_range diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_route.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_route.py index 8c47bea3545b..9662b5519d09 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_route.py @@ -51,6 +51,7 @@ class EffectiveRoute(Model): } def __init__(self, name=None, source=None, state=None, address_prefix=None, next_hop_ip_address=None, next_hop_type=None): + super(EffectiveRoute, self).__init__() self.name = name self.source = source self.state = state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_route_list_result.py index 2959a6ae629f..80f3ac41f5f1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/effective_route_list_result.py @@ -34,5 +34,6 @@ class EffectiveRouteListResult(Model): } def __init__(self, value=None): + super(EffectiveRouteListResult, self).__init__() self.value = value self.next_link = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/error.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/error.py index d4daaca4b35d..c563e256c112 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/error.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/error.py @@ -36,6 +36,7 @@ class Error(Model): } def __init__(self, code=None, message=None, target=None, details=None, inner_error=None): + super(Error, self).__init__() self.code = code self.message = message self.target = target diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/error_details.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/error_details.py index 47f2ac4111b1..40bea00aa2fb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/error_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/error_details.py @@ -30,6 +30,7 @@ class ErrorDetails(Model): } def __init__(self, code=None, target=None, message=None): + super(ErrorDetails, self).__init__() self.code = code self.target = target self.message = message diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_arp_table.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_arp_table.py index a2f8f716bf8a..ace325747ee5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_arp_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_arp_table.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitArpTable(Model): } def __init__(self, age=None, interface=None, ip_address=None, mac_address=None): + super(ExpressRouteCircuitArpTable, self).__init__() self.age = age self.interface = interface self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_peering_config.py index aba4bd8ec9f3..ca797c1c8b5a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_peering_config.py @@ -46,6 +46,7 @@ class ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, advertised_public_prefixes=None, advertised_communities=None, advertised_public_prefixes_state=None, legacy_mode=None, customer_asn=None, routing_registry_name=None): + super(ExpressRouteCircuitPeeringConfig, self).__init__() self.advertised_public_prefixes = advertised_public_prefixes self.advertised_communities = advertised_communities self.advertised_public_prefixes_state = advertised_public_prefixes_state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_routes_table.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_routes_table.py index e84fae6e0973..804d29a2f9bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_routes_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_routes_table.py @@ -36,6 +36,7 @@ class ExpressRouteCircuitRoutesTable(Model): } def __init__(self, network=None, next_hop=None, loc_prf=None, weight=None, path=None): + super(ExpressRouteCircuitRoutesTable, self).__init__() self.network = network self.next_hop = next_hop self.loc_prf = loc_prf diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_routes_table_summary.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_routes_table_summary.py index 3ff1b42d0c1b..6f5f89764dd4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_routes_table_summary.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_routes_table_summary.py @@ -38,6 +38,7 @@ class ExpressRouteCircuitRoutesTableSummary(Model): } def __init__(self, neighbor=None, v=None, as_property=None, up_down=None, state_pfx_rcd=None): + super(ExpressRouteCircuitRoutesTableSummary, self).__init__() self.neighbor = neighbor self.v = v self.as_property = as_property diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_service_provider_properties.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_service_provider_properties.py index b7ada851e235..7a6b4ba96061 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_service_provider_properties.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_service_provider_properties.py @@ -30,6 +30,7 @@ class ExpressRouteCircuitServiceProviderProperties(Model): } def __init__(self, service_provider_name=None, peering_location=None, bandwidth_in_mbps=None): + super(ExpressRouteCircuitServiceProviderProperties, self).__init__() self.service_provider_name = service_provider_name self.peering_location = peering_location self.bandwidth_in_mbps = bandwidth_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_sku.py index f7742dd224f9..2ce54f762a35 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_sku.py @@ -34,6 +34,7 @@ class ExpressRouteCircuitSku(Model): } def __init__(self, name=None, tier=None, family=None): + super(ExpressRouteCircuitSku, self).__init__() self.name = name self.tier = tier self.family = family diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_stats.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_stats.py index 1215bda40383..e26f6f7d2f74 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_stats.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuit_stats.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitStats(Model): } def __init__(self, primarybytes_in=None, primarybytes_out=None, secondarybytes_in=None, secondarybytes_out=None): + super(ExpressRouteCircuitStats, self).__init__() self.primarybytes_in = primarybytes_in self.primarybytes_out = primarybytes_out self.secondarybytes_in = secondarybytes_in diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_arp_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_arp_table_list_result.py index da0f60ab0f5c..b071f1eadb5e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_arp_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_arp_table_list_result.py @@ -28,5 +28,6 @@ class ExpressRouteCircuitsArpTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsArpTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_routes_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_routes_table_list_result.py index 127cb8a5d27a..008a841c6a24 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_routes_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_routes_table_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_routes_table_summary_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_routes_table_summary_list_result.py index 4808701d4e95..c28535c7332e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_routes_table_summary_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_circuits_routes_table_summary_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableSummaryListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableSummaryListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_service_provider_bandwidths_offered.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_service_provider_bandwidths_offered.py index b1b2c8a76447..9cbba2fcfe97 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_service_provider_bandwidths_offered.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/express_route_service_provider_bandwidths_offered.py @@ -27,5 +27,6 @@ class ExpressRouteServiceProviderBandwidthsOffered(Model): } def __init__(self, offer_name=None, value_in_mbps=None): + super(ExpressRouteServiceProviderBandwidthsOffered, self).__init__() self.offer_name = offer_name self.value_in_mbps = value_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/flow_log_information.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/flow_log_information.py index d1108d2e4ec0..8add31610fea 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/flow_log_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/flow_log_information.py @@ -42,6 +42,7 @@ class FlowLogInformation(Model): } def __init__(self, target_resource_id, storage_id, enabled, retention_policy=None): + super(FlowLogInformation, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/flow_log_status_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/flow_log_status_parameters.py index 1dae2ff24447..4cd22222bb45 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/flow_log_status_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/flow_log_status_parameters.py @@ -29,4 +29,5 @@ class FlowLogStatusParameters(Model): } def __init__(self, target_resource_id): + super(FlowLogStatusParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/gateway_route.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/gateway_route.py index d3e0d4163c35..64a53f146c0b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/gateway_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/gateway_route.py @@ -55,6 +55,7 @@ class GatewayRoute(Model): } def __init__(self): + super(GatewayRoute, self).__init__() self.local_address = None self.network = None self.next_hop = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/gateway_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/gateway_route_list_result.py index 58675d003de6..da2446f3c251 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/gateway_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/gateway_route_list_result.py @@ -24,4 +24,5 @@ class GatewayRouteListResult(Model): } def __init__(self, value=None): + super(GatewayRouteListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ip_address_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ip_address_availability_result.py index 0e26dd91fffc..f2cb36a550ec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ip_address_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ip_address_availability_result.py @@ -28,5 +28,6 @@ class IPAddressAvailabilityResult(Model): } def __init__(self, available=None, available_ip_addresses=None): + super(IPAddressAvailabilityResult, self).__init__() self.available = available self.available_ip_addresses = available_ip_addresses diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ipsec_policy.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ipsec_policy.py index 0780990d2304..a842af40b4c3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ipsec_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ipsec_policy.py @@ -74,6 +74,7 @@ class IpsecPolicy(Model): } def __init__(self, sa_life_time_seconds, sa_data_size_kilobytes, ipsec_encryption, ipsec_integrity, ike_encryption, ike_integrity, dh_group, pfs_group): + super(IpsecPolicy, self).__init__() self.sa_life_time_seconds = sa_life_time_seconds self.sa_data_size_kilobytes = sa_data_size_kilobytes self.ipsec_encryption = ipsec_encryption diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ipv6_express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ipv6_express_route_circuit_peering_config.py index 79af3ae2f4e7..da2ab4cb1659 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ipv6_express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/ipv6_express_route_circuit_peering_config.py @@ -39,6 +39,7 @@ class Ipv6ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, primary_peer_address_prefix=None, secondary_peer_address_prefix=None, microsoft_peering_config=None, route_filter=None, state=None): + super(Ipv6ExpressRouteCircuitPeeringConfig, self).__init__() self.primary_peer_address_prefix = primary_peer_address_prefix self.secondary_peer_address_prefix = secondary_peer_address_prefix self.microsoft_peering_config = microsoft_peering_config diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/network_interface_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/network_interface_association.py index 8e9316b2e20c..28a998ae366a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/network_interface_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/network_interface_association.py @@ -35,5 +35,6 @@ class NetworkInterfaceAssociation(Model): } def __init__(self, security_rules=None): + super(NetworkInterfaceAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/network_interface_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/network_interface_dns_settings.py index 110594c2f928..675a4a1eb08a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/network_interface_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/network_interface_dns_settings.py @@ -47,6 +47,7 @@ class NetworkInterfaceDnsSettings(Model): } def __init__(self, dns_servers=None, applied_dns_servers=None, internal_dns_name_label=None, internal_fqdn=None, internal_domain_name_suffix=None): + super(NetworkInterfaceDnsSettings, self).__init__() self.dns_servers = dns_servers self.applied_dns_servers = applied_dns_servers self.internal_dns_name_label = internal_dns_name_label diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/next_hop_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/next_hop_parameters.py index f38a8ce62abb..3e1478409a0a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/next_hop_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/next_hop_parameters.py @@ -42,6 +42,7 @@ class NextHopParameters(Model): } def __init__(self, target_resource_id, source_ip_address, destination_ip_address, target_nic_resource_id=None): + super(NextHopParameters, self).__init__() self.target_resource_id = target_resource_id self.source_ip_address = source_ip_address self.destination_ip_address = destination_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/next_hop_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/next_hop_result.py index 15cc052fa891..e2efff85a945 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/next_hop_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/next_hop_result.py @@ -36,6 +36,7 @@ class NextHopResult(Model): } def __init__(self, next_hop_type=None, next_hop_ip_address=None, route_table_id=None): + super(NextHopResult, self).__init__() self.next_hop_type = next_hop_type self.next_hop_ip_address = next_hop_ip_address self.route_table_id = route_table_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture.py index fbb14c53a8e1..cd1dfc5d392f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture.py @@ -50,6 +50,7 @@ class PacketCapture(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCapture, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_filter.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_filter.py index 645071680884..d66a139abe79 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_filter.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_filter.py @@ -52,6 +52,7 @@ class PacketCaptureFilter(Model): } def __init__(self, protocol="Any", local_ip_address=None, remote_ip_address=None, local_port=None, remote_port=None): + super(PacketCaptureFilter, self).__init__() self.protocol = protocol self.local_ip_address = local_ip_address self.remote_ip_address = remote_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_parameters.py index efa16b8200e3..2e94f0848506 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_parameters.py @@ -50,6 +50,7 @@ class PacketCaptureParameters(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCaptureParameters, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_query_status_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_query_status_result.py index c240e7625565..12ee5efaf002 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_query_status_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_query_status_result.py @@ -44,6 +44,7 @@ class PacketCaptureQueryStatusResult(Model): } def __init__(self, name=None, id=None, capture_start_time=None, packet_capture_status=None, stop_reason=None, packet_capture_error=None): + super(PacketCaptureQueryStatusResult, self).__init__() self.name = name self.id = id self.capture_start_time = capture_start_time diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_result.py index a0f152c7485e..1930afcdf9da 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_result.py @@ -71,6 +71,7 @@ class PacketCaptureResult(Model): } def __init__(self, target, storage_location, etag="A unique read-only string that changes whenever the resource is updated.", bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None, provisioning_state=None): + super(PacketCaptureResult, self).__init__() self.name = None self.id = None self.etag = etag diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_storage_location.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_storage_location.py index d0987d11ff9f..773b04d22501 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_storage_location.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/packet_capture_storage_location.py @@ -36,6 +36,7 @@ class PacketCaptureStorageLocation(Model): } def __init__(self, storage_id=None, storage_path=None, file_path=None): + super(PacketCaptureStorageLocation, self).__init__() self.storage_id = storage_id self.storage_path = storage_path self.file_path = file_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/public_ip_address_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/public_ip_address_dns_settings.py index 65a534407848..a248461f05d7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/public_ip_address_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/public_ip_address_dns_settings.py @@ -39,6 +39,7 @@ class PublicIPAddressDnsSettings(Model): } def __init__(self, domain_name_label=None, fqdn=None, reverse_fqdn=None): + super(PublicIPAddressDnsSettings, self).__init__() self.domain_name_label = domain_name_label self.fqdn = fqdn self.reverse_fqdn = reverse_fqdn diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/query_troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/query_troubleshooting_parameters.py index a394b181fcc5..9b6801eb7b63 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/query_troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/query_troubleshooting_parameters.py @@ -29,4 +29,5 @@ class QueryTroubleshootingParameters(Model): } def __init__(self, target_resource_id): + super(QueryTroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/resource.py index ef9699426827..ff5f1f40e14e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/resource.py @@ -44,6 +44,7 @@ class Resource(Model): } def __init__(self, id=None, location=None, tags=None): + super(Resource, self).__init__() self.id = id self.name = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/retention_policy_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/retention_policy_parameters.py index 58f7f12cc6a9..102f4c5c3b4c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/retention_policy_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/retention_policy_parameters.py @@ -27,5 +27,6 @@ class RetentionPolicyParameters(Model): } def __init__(self, days=0, enabled=False): + super(RetentionPolicyParameters, self).__init__() self.days = days self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_network_interface.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_network_interface.py index bfa5643d9274..6af1b2da6936 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_network_interface.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_network_interface.py @@ -28,5 +28,6 @@ class SecurityGroupNetworkInterface(Model): } def __init__(self, id=None, security_rule_associations=None): + super(SecurityGroupNetworkInterface, self).__init__() self.id = id self.security_rule_associations = security_rule_associations diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_view_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_view_parameters.py index 304908dd4792..5c0972e5d55e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_view_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_view_parameters.py @@ -28,4 +28,5 @@ class SecurityGroupViewParameters(Model): } def __init__(self, target_resource_id): + super(SecurityGroupViewParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_view_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_view_result.py index 4f9ea43fed0e..1e32d3fa2acf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_view_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_group_view_result.py @@ -25,4 +25,5 @@ class SecurityGroupViewResult(Model): } def __init__(self, network_interfaces=None): + super(SecurityGroupViewResult, self).__init__() self.network_interfaces = network_interfaces diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_rule.py index e47dba350098..98ba7895cdd2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_rule.py @@ -101,7 +101,7 @@ class SecurityRule(SubResource): 'etag': {'key': 'etag', 'type': 'str'}, } - def __init__(self, protocol, source_address_prefix=None, destination_address_prefix=None, access=None, direction=None, id=None, description=None, source_port_range=None, destination_port_range=None, source_address_prefixes=None, destination_address_prefixes=None, source_port_ranges=None, destination_port_ranges=None, priority=None, provisioning_state=None, name=None, etag=None): + def __init__(self, protocol, access, direction, id=None, description=None, source_port_range=None, destination_port_range=None, source_address_prefix=None, source_address_prefixes=None, destination_address_prefix=None, destination_address_prefixes=None, source_port_ranges=None, destination_port_ranges=None, priority=None, provisioning_state=None, name=None, etag=None): super(SecurityRule, self).__init__(id=id) self.description = description self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_rule_associations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_rule_associations.py index 338b7e3f45e5..4caad0293abe 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_rule_associations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/security_rule_associations.py @@ -38,6 +38,7 @@ class SecurityRuleAssociations(Model): } def __init__(self, network_interface_association=None, subnet_association=None, default_security_rules=None, effective_security_rules=None): + super(SecurityRuleAssociations, self).__init__() self.network_interface_association = network_interface_association self.subnet_association = subnet_association self.default_security_rules = default_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/service_endpoint_properties_format.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/service_endpoint_properties_format.py index 0168d03284a9..847cb9ac8b3b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/service_endpoint_properties_format.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/service_endpoint_properties_format.py @@ -30,6 +30,7 @@ class ServiceEndpointPropertiesFormat(Model): } def __init__(self, service=None, locations=None, provisioning_state=None): + super(ServiceEndpointPropertiesFormat, self).__init__() self.service = service self.locations = locations self.provisioning_state = provisioning_state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/sub_resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/sub_resource.py index b23dc42afd0e..491f1d1caf83 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/sub_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/sub_resource.py @@ -24,4 +24,5 @@ class SubResource(Model): } def __init__(self, id=None): + super(SubResource, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/subnet_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/subnet_association.py index a44da55e1642..f1180c50800e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/subnet_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/subnet_association.py @@ -35,5 +35,6 @@ class SubnetAssociation(Model): } def __init__(self, security_rules=None): + super(SubnetAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology.py index 5aceab105b34..8aa831c6dffc 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology.py @@ -44,6 +44,7 @@ class Topology(Model): } def __init__(self, resources=None): + super(Topology, self).__init__() self.id = None self.created_date_time = None self.last_modified = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_association.py index 95b5993181ae..7e4c2d71194f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_association.py @@ -34,6 +34,7 @@ class TopologyAssociation(Model): } def __init__(self, name=None, resource_id=None, association_type=None): + super(TopologyAssociation, self).__init__() self.name = name self.resource_id = resource_id self.association_type = association_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_parameters.py index c2f674cad7fc..04920dc9665d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_parameters.py @@ -29,4 +29,5 @@ class TopologyParameters(Model): } def __init__(self, target_resource_group_name): + super(TopologyParameters, self).__init__() self.target_resource_group_name = target_resource_group_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_resource.py index 94436becf32b..bf8b863a622c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/topology_resource.py @@ -35,6 +35,7 @@ class TopologyResource(Model): } def __init__(self, name=None, id=None, location=None, associations=None): + super(TopologyResource, self).__init__() self.name = name self.id = id self.location = location diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_details.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_details.py index a4757585f3c6..eaacbd32f814 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_details.py @@ -37,6 +37,7 @@ class TroubleshootingDetails(Model): } def __init__(self, id=None, reason_type=None, summary=None, detail=None, recommended_actions=None): + super(TroubleshootingDetails, self).__init__() self.id = id self.reason_type = reason_type self.summary = summary diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_parameters.py index d6bd7ebe04e6..c4833fb8eeb3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_parameters.py @@ -38,6 +38,7 @@ class TroubleshootingParameters(Model): } def __init__(self, target_resource_id, storage_id, storage_path): + super(TroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.storage_path = storage_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_recommended_actions.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_recommended_actions.py index 479eb32b8fa8..cbc5e31177c7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_recommended_actions.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_recommended_actions.py @@ -35,6 +35,7 @@ class TroubleshootingRecommendedActions(Model): } def __init__(self, action_id=None, action_text=None, action_uri=None, action_uri_text=None): + super(TroubleshootingRecommendedActions, self).__init__() self.action_id = action_id self.action_text = action_text self.action_uri = action_uri diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_result.py index 070bbc67464b..828d6bc4bace 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/troubleshooting_result.py @@ -34,6 +34,7 @@ class TroubleshootingResult(Model): } def __init__(self, start_time=None, end_time=None, code=None, results=None): + super(TroubleshootingResult, self).__init__() self.start_time = start_time self.end_time = end_time self.code = code diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/tunnel_connection_health.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/tunnel_connection_health.py index cb94f6c69622..eee04fd93565 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/tunnel_connection_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/tunnel_connection_health.py @@ -53,6 +53,7 @@ class TunnelConnectionHealth(Model): } def __init__(self): + super(TunnelConnectionHealth, self).__init__() self.tunnel = None self.connection_status = None self.ingress_bytes_transferred = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/usage.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/usage.py index 3fde1e1ae63e..66dd45e002c0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/usage.py @@ -46,6 +46,7 @@ class Usage(Model): unit = "Count" def __init__(self, current_value, limit, name): + super(Usage, self).__init__() self.current_value = current_value self.limit = limit self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/usage_name.py index 87786b60cf62..df7f344bfb9b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/usage_name.py @@ -27,5 +27,6 @@ class UsageName(Model): } def __init__(self, value=None, localized_value=None): + super(UsageName, self).__init__() self.value = value self.localized_value = localized_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/verification_ip_flow_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/verification_ip_flow_parameters.py index b0486d2fd807..64701eea9146 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/verification_ip_flow_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/verification_ip_flow_parameters.py @@ -66,6 +66,7 @@ class VerificationIPFlowParameters(Model): } def __init__(self, target_resource_id, direction, protocol, local_port, remote_port, local_ip_address, remote_ip_address, target_nic_resource_id=None): + super(VerificationIPFlowParameters, self).__init__() self.target_resource_id = target_resource_id self.direction = direction self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/verification_ip_flow_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/verification_ip_flow_result.py index 3caa0f0329ea..55a7a12608f8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/verification_ip_flow_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/verification_ip_flow_result.py @@ -29,5 +29,6 @@ class VerificationIPFlowResult(Model): } def __init__(self, access=None, rule_name=None): + super(VerificationIPFlowResult, self).__init__() self.access = access self.rule_name = rule_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_connection_gateway_reference.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_connection_gateway_reference.py index f50295906ad8..eb18a3c124ff 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_connection_gateway_reference.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_connection_gateway_reference.py @@ -29,4 +29,5 @@ class VirtualNetworkConnectionGatewayReference(Model): } def __init__(self, id): + super(VirtualNetworkConnectionGatewayReference, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_gateway_sku.py index 835dd891ba59..1499a91c9c49 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_gateway_sku.py @@ -36,6 +36,7 @@ class VirtualNetworkGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(VirtualNetworkGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_usage.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_usage.py index d5b7e7a606a0..27c5bd4dc8b7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_usage.py @@ -48,6 +48,7 @@ class VirtualNetworkUsage(Model): } def __init__(self): + super(VirtualNetworkUsage, self).__init__() self.current_value = None self.id = None self.limit = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_usage_name.py index dd93c0846a5c..01fcbf0875eb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_usage_name.py @@ -35,5 +35,6 @@ class VirtualNetworkUsageName(Model): } def __init__(self): + super(VirtualNetworkUsageName, self).__init__() self.localized_value = None self.value = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/vpn_client_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/vpn_client_configuration.py index b3b3d170b738..d901a9fd0733 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/vpn_client_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/vpn_client_configuration.py @@ -49,6 +49,7 @@ class VpnClientConfiguration(Model): } def __init__(self, vpn_client_address_pool=None, vpn_client_root_certificates=None, vpn_client_revoked_certificates=None, vpn_client_protocols=None, radius_server_address=None, radius_server_secret=None): + super(VpnClientConfiguration, self).__init__() self.vpn_client_address_pool = vpn_client_address_pool self.vpn_client_root_certificates = vpn_client_root_certificates self.vpn_client_revoked_certificates = vpn_client_revoked_certificates diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/vpn_client_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/vpn_client_parameters.py index 39bcbdd85ecb..49b0047a0425 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/vpn_client_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/vpn_client_parameters.py @@ -43,6 +43,7 @@ class VpnClientParameters(Model): } def __init__(self, processor_architecture=None, authentication_method=None, radius_server_auth_certificate=None, client_root_certificates=None): + super(VpnClientParameters, self).__init__() self.processor_architecture = processor_architecture self.authentication_method = authentication_method self.radius_server_auth_certificate = radius_server_auth_certificate diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/network_management_client.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/network_management_client.py index df98d9a27ad5..bbf4f178bfd2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/network_management_client.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/network_management_client.py @@ -302,7 +302,7 @@ def check_dns_name_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/application_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/application_gateways_operations.py index 9707cd4a01c3..5c9d70a7a404 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/application_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/application_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param parameters: Parameters supplied to the create or update - application gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.ApplicationGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ApplicationGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ApplicationGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update + application gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.ApplicationGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ApplicationGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('ApplicationGateway', response) + deserialized = self._deserialize('ApplicationGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -381,7 +431,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -400,23 +450,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def start( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Starts the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _start_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start' path_format_arguments = { @@ -441,18 +477,58 @@ def start( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 start( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Starts the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._start_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -465,10 +541,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -476,23 +548,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Stops the specified application gateway in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop' path_format_arguments = { @@ -517,18 +575,58 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def stop( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Stops the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -541,10 +639,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -552,28 +646,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def backend_health( - self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Gets the backend health of the specified application gateway in a - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param expand: Expands BackendAddressPool and BackendHttpSettings - referenced in backend health. - :type expand: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGatewayBackendHealth or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ApplicationGatewayBackendHealth] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _backend_health_initial( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth' path_format_arguments = { @@ -600,18 +675,71 @@ def backend_health( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ApplicationGatewayBackendHealth', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def backend_health( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets the backend health of the specified application gateway in a + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param expand: Expands BackendAddressPool and BackendHttpSettings + referenced in backend health. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGatewayBackendHealth or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ApplicationGatewayBackendHealth] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._backend_health_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + expand=expand, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -620,10 +748,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) + deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -631,10 +756,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -681,7 +802,7 @@ def list_available_waf_rule_sets( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -738,7 +859,7 @@ def list_available_ssl_options( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -802,7 +923,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -863,7 +984,7 @@ def get_ssl_predefined_policy( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/available_endpoint_services_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/available_endpoint_services_operations.py index 28187467c752..15e2c8046d11 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/available_endpoint_services_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/available_endpoint_services_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/bgp_service_communities_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/bgp_service_communities_operations.py index 590fe5fe74b0..a395eef8f3ff 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/bgp_service_communities_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/bgp_service_communities_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/default_security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/default_security_rules_operations.py index 378155400292..253de9d12119 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/default_security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/default_security_rules_operations.py @@ -89,7 +89,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -156,7 +156,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuit_authorizations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuit_authorizations_operations.py index 4523ff55b7ad..aa650d3b3599 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuit_authorizations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuit_authorizations_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified authorization from the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified authorization from the specified express route + circuit. - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,31 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an authorization in the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param authorization_parameters: Parameters supplied to the create or - update express route circuit authorization operation. - :type authorization_parameters: - ~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitAuthorization - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitAuthorization] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -238,19 +240,78 @@ def create_or_update( body_content = self._serialize.body(authorization_parameters, 'ExpressRouteCircuitAuthorization') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization in the specified express route + circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or + update express route circuit authorization operation. + :type authorization_parameters: + ~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitAuthorization + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitAuthorization] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + authorization_parameters=authorization_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -259,12 +320,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -272,10 +328,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuit_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuit_peerings_operations.py index e8e50c5914b9..7a11119c6026 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuit_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuit_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified peering from the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified peering from the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified express route circuits. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param peering_parameters: Parameters supplied to the create or update - express route circuit peering operation. - :type peering_parameters: - ~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(peering_parameters, 'ExpressRouteCircuitPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + express route circuit peering operation. + :type peering_parameters: + ~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + peering_parameters=peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuits_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuits_operations.py index 6f593bb137b7..db3263e81091 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuits_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_circuits_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the circuit. - :type circuit_name: str - :param parameters: Parameters supplied to the create or update express - route circuit operation. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuit - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuit or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuit] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ExpressRouteCircuit') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuit', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuit', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the circuit. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express + route circuit operation. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuit + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuit or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuit] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuit', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuit', response) + deserialized = self._deserialize('ExpressRouteCircuit', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -269,30 +319,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_arp_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised ARP table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsArpTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitsArpTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_arp_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}' path_format_arguments = { @@ -319,18 +348,74 @@ def list_arp_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ExpressRouteCircuitsArpTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_arp_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised ARP table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsArpTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitsArpTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_arp_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -339,10 +424,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -350,10 +432,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -361,30 +439,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitsRoutesTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}' path_format_arguments = { @@ -411,18 +468,74 @@ def list_routes_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsRoutesTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitsRoutesTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -431,10 +544,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -442,10 +552,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -453,30 +559,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table_summary( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table summary associated with the - express route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse - if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_summary_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}' path_format_arguments = { @@ -503,18 +588,74 @@ def list_routes_table_summary( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table_summary( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table summary associated with the + express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse + if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -523,10 +664,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -534,10 +672,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -589,7 +723,7 @@ def get_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -654,7 +788,7 @@ def get_peering_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -720,7 +854,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -784,7 +918,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_service_providers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_service_providers_operations.py index dc6ab21d036c..ed0d62afbef3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_service_providers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/express_route_service_providers_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/inbound_nat_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/inbound_nat_rules_operations.py index 73c0b8d5428b..426b8f742cfd 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/inbound_nat_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/inbound_nat_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -108,25 +109,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def delete( - self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer inbound nat rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param inbound_nat_rule_name: The name of the inbound nat rule. - :type inbound_nat_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}' path_format_arguments = { @@ -152,18 +137,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer inbound nat rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound nat rule. + :type inbound_nat_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -176,10 +204,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -237,7 +261,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -255,30 +279,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer inbound nat rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param inbound_nat_rule_name: The name of the inbound nat rule. - :type inbound_nat_rule_name: str - :param inbound_nat_rule_parameters: Parameters supplied to the create - or update inbound nat rule operation. - :type inbound_nat_rule_parameters: - ~azure.mgmt.network.v2017_06_01.models.InboundNatRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - InboundNatRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.InboundNatRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}' path_format_arguments = { @@ -307,19 +310,77 @@ def create_or_update( body_content = self._serialize.body(inbound_nat_rule_parameters, 'InboundNatRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('InboundNatRule', response) + if response.status_code == 201: + deserialized = self._deserialize('InboundNatRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer inbound nat rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound nat rule. + :type inbound_nat_rule_name: str + :param inbound_nat_rule_parameters: Parameters supplied to the create + or update inbound nat rule operation. + :type inbound_nat_rule_parameters: + ~azure.mgmt.network.v2017_06_01.models.InboundNatRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + InboundNatRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.InboundNatRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + inbound_nat_rule_parameters=inbound_nat_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -328,12 +389,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('InboundNatRule', response) - if response.status_code == 201: - deserialized = self._deserialize('InboundNatRule', response) + deserialized = self._deserialize('InboundNatRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -341,10 +397,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_backend_address_pools_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_backend_address_pools_operations.py index bba9484f4113..cbbd0890a63e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_backend_address_pools_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_backend_address_pools_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -154,7 +154,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_frontend_ip_configurations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_frontend_ip_configurations_operations.py index 1c920b85f2ef..06bec2406362 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_frontend_ip_configurations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_frontend_ip_configurations_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -154,7 +154,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_load_balancing_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_load_balancing_rules_operations.py index 0361fb8793eb..4d1d0deeecc6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_load_balancing_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_load_balancing_rules_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -153,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_network_interfaces_operations.py index fc611f8a51b0..df9e8fc517de 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_network_interfaces_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_probes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_probes_operations.py index b10a3fd18df2..3c90ae774107 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_probes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancer_probes_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -153,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancers_operations.py index bf3065286caf..8b1076a46f3b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/load_balancers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param parameters: Parameters supplied to the create or update load - balancer operation. - :type parameters: ~azure.mgmt.network.v2017_06_01.models.LoadBalancer - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns LoadBalancer - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.LoadBalancer] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LoadBalancer') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LoadBalancer', response) + if response.status_code == 201: + deserialized = self._deserialize('LoadBalancer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load + balancer operation. + :type parameters: ~azure.mgmt.network.v2017_06_01.models.LoadBalancer + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns LoadBalancer + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.LoadBalancer] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LoadBalancer', response) - if response.status_code == 201: - deserialized = self._deserialize('LoadBalancer', response) + deserialized = self._deserialize('LoadBalancer', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/local_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/local_network_gateways_operations.py index 6f4d47fe5c36..f528a1ba576e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/local_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/local_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a local network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param parameters: Parameters supplied to the create or update local - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.LocalNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - LocalNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.LocalNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LocalNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocalNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('LocalNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a local network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.LocalNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + LocalNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.LocalNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LocalNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('LocalNetworkGateway', response) + deserialized = self._deserialize('LocalNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified local network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified local network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interface_ip_configurations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interface_ip_configurations_operations.py index 8d796fbc5455..62cb46a659fe 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interface_ip_configurations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interface_ip_configurations_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -155,7 +155,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interface_load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interface_load_balancers_operations.py index 137066d73466..328b941df755 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interface_load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interface_load_balancers_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interfaces_operations.py index c831a8d0b74e..4fe7d296de03 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_interfaces_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -36,23 +37,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-06-01" # Construct URL @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,28 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param parameters: Parameters supplied to the create or update network - interface operation. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.NetworkInterface - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkInterface or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.NetworkInterface] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2017-06-01" # Construct URL @@ -232,19 +236,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkInterface') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkInterface', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkInterface', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network + interface operation. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.NetworkInterface + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkInterface or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.NetworkInterface] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkInterface', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkInterface', response) + deserialized = self._deserialize('NetworkInterface', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -324,7 +374,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -393,7 +443,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -412,24 +462,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def get_effective_route_table( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all route tables applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.EffectiveRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_effective_route_table_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-06-01" # Construct URL @@ -456,18 +491,66 @@ def get_effective_route_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_effective_route_table( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all route tables applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.EffectiveRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_effective_route_table_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -476,10 +559,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveRouteListResult', response) + deserialized = self._deserialize('EffectiveRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -487,10 +567,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -498,25 +574,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_effective_network_security_groups( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all network security groups applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveNetworkSecurityGroupListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.EffectiveNetworkSecurityGroupListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_effective_network_security_groups_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-06-01" # Construct URL @@ -543,18 +603,67 @@ def list_effective_network_security_groups( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveNetworkSecurityGroupListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_effective_network_security_groups( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all network security groups applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveNetworkSecurityGroupListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.EffectiveNetworkSecurityGroupListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_effective_network_security_groups_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -563,10 +672,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) + deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -574,10 +680,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -643,7 +745,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -716,7 +818,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -791,7 +893,7 @@ def get_virtual_machine_scale_set_network_interface( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_security_groups_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_security_groups_operations.py index e6194bd2b2a7..464fc8b9d8ba 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_security_groups_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_security_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,24 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -80,18 +66,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def delete( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -104,10 +131,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network security group in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param parameters: Parameters supplied to the create or update network - security group operation. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.NetworkSecurityGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.NetworkSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -232,19 +234,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkSecurityGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network security group in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network + security group operation. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.NetworkSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.NetworkSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkSecurityGroup', response) + deserialized = self._deserialize('NetworkSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -322,7 +372,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -389,7 +439,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_watchers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_watchers_operations.py index 6f93dd935a30..25fca65cd4ca 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_watchers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/network_watchers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -152,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -170,23 +171,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network watcher resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}' path_format_arguments = { @@ -211,18 +198,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network watcher resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -235,10 +262,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -294,7 +317,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -358,7 +381,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -429,7 +452,7 @@ def get_topology( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -447,28 +470,9 @@ def get_topology( return deserialized - def verify_ip_flow( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Verify IP flow from the specified VM to a location given the currently - configured NSG rules. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the IP flow to be verified. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.VerificationIPFlowParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VerificationIPFlowResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VerificationIPFlowResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _verify_ip_flow_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify' path_format_arguments = { @@ -496,19 +500,74 @@ def verify_ip_flow( body_content = self._serialize.body(parameters, 'VerificationIPFlowParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('VerificationIPFlowResult', response) + if response.status_code == 202: + deserialized = self._deserialize('VerificationIPFlowResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def verify_ip_flow( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Verify IP flow from the specified VM to a location given the currently + configured NSG rules. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.VerificationIPFlowParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VerificationIPFlowResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VerificationIPFlowResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._verify_ip_flow_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -517,12 +576,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VerificationIPFlowResult', response) - if response.status_code == 202: - deserialized = self._deserialize('VerificationIPFlowResult', response) + deserialized = self._deserialize('VerificationIPFlowResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -530,10 +584,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -541,28 +591,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_next_hop( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Gets the next hop from the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the source and destination - endpoint. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.NextHopParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NextHopResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.NextHopResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_next_hop_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop' path_format_arguments = { @@ -590,19 +621,74 @@ def get_next_hop( body_content = self._serialize.body(parameters, 'NextHopParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('NextHopResult', response) + if response.status_code == 202: + deserialized = self._deserialize('NextHopResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_next_hop( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination + endpoint. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.NextHopParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NextHopResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.NextHopResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_next_hop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -611,12 +697,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NextHopResult', response) - if response.status_code == 202: - deserialized = self._deserialize('NextHopResult', response) + deserialized = self._deserialize('NextHopResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -624,10 +705,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -635,27 +712,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_vm_security_rules( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Gets the configured and effective security group rules on the specified - VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param target_resource_id: ID of the target VM. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - SecurityGroupViewResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.SecurityGroupViewResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_vm_security_rules_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.SecurityGroupViewParameters(target_resource_id=target_resource_id) # Construct URL @@ -685,19 +744,73 @@ def get_vm_security_rules( body_content = self._serialize.body(parameters, 'SecurityGroupViewParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('SecurityGroupViewResult', response) + if response.status_code == 202: + deserialized = self._deserialize('SecurityGroupViewResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_vm_security_rules( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the configured and effective security group rules on the specified + VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param target_resource_id: ID of the target VM. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + SecurityGroupViewResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.SecurityGroupViewResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_vm_security_rules_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -706,12 +819,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityGroupViewResult', response) - if response.status_code == 202: - deserialized = self._deserialize('SecurityGroupViewResult', response) + deserialized = self._deserialize('SecurityGroupViewResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -719,10 +827,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -730,28 +834,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Initiate troubleshooting on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the resource to - troubleshoot. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.TroubleshootingParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot' path_format_arguments = { @@ -779,19 +864,74 @@ def get_troubleshooting( body_content = self._serialize.body(parameters, 'TroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to + troubleshoot. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.TroubleshootingParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -800,12 +940,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -813,10 +948,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -824,27 +955,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting_result( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Get the last completed troubleshooting result on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource ID to query the - troubleshooting result. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_result_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.QueryTroubleshootingParameters(target_resource_id=target_resource_id) # Construct URL @@ -874,19 +987,73 @@ def get_troubleshooting_result( body_content = self._serialize.body(parameters, 'QueryTroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting_result( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource ID to query the + troubleshooting result. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_result_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -895,12 +1062,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -908,10 +1070,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -919,29 +1077,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_flow_log_configuration( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Configures flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the configuration of flow - log. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.FlowLogInformation - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_flow_log_configuration_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog' path_format_arguments = { @@ -969,19 +1107,75 @@ def set_flow_log_configuration( body_content = self._serialize.body(parameters, 'FlowLogInformation') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_flow_log_configuration( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Configures flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow + log. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.FlowLogInformation + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_flow_log_configuration_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -990,12 +1184,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1003,10 +1192,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1014,28 +1199,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_flow_log_status( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Queries status of flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource where getting the flow - logging status. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_flow_log_status_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.FlowLogStatusParameters(target_resource_id=target_resource_id) # Construct URL @@ -1065,19 +1231,74 @@ def get_flow_log_status( body_content = self._serialize.body(parameters, 'FlowLogStatusParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_flow_log_status( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Queries status of flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource where getting the flow + logging status. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_flow_log_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1086,12 +1307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1099,10 +1315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1110,33 +1322,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def check_connectivity( - self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): - """Verifies the possibility of establishing a direct TCP connection from a - virtual machine to a given endpoint including another VM or an - arbitrary remote server. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param source: - :type source: - ~azure.mgmt.network.v2017_06_01.models.ConnectivitySource - :param destination: - :type destination: - ~azure.mgmt.network.v2017_06_01.models.ConnectivityDestination - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectivityInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ConnectivityInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _check_connectivity_initial( + self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectivityParameters(source=source, destination=destination) # Construct URL @@ -1166,19 +1354,80 @@ def check_connectivity( body_content = self._serialize.body(parameters, 'ConnectivityParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectivityInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('ConnectivityInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def check_connectivity( + self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): + """Verifies the possibility of establishing a direct TCP connection from a + virtual machine to a given endpoint including another VM or an + arbitrary remote server. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param source: + :type source: + ~azure.mgmt.network.v2017_06_01.models.ConnectivitySource + :param destination: + :type destination: + ~azure.mgmt.network.v2017_06_01.models.ConnectivityDestination + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectivityInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ConnectivityInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._check_connectivity_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + source=source, + destination=destination, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1187,12 +1436,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectivityInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('ConnectivityInformation', response) + deserialized = self._deserialize('ConnectivityInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1200,10 +1444,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/packet_captures_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/packet_captures_operations.py index b543f59e32b3..9f5c976230df 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/packet_captures_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/packet_captures_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,29 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create( - self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create and start a packet capture on the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param parameters: Parameters that define the create packet capture - operation. - :type parameters: ~azure.mgmt.network.v2017_06_01.models.PacketCapture - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.PacketCaptureResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -89,19 +70,74 @@ def create( body_content = self._serialize.body(parameters, 'PacketCapture') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('PacketCaptureResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture + operation. + :type parameters: ~azure.mgmt.network.v2017_06_01.models.PacketCapture + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.PacketCaptureResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,10 +146,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('PacketCaptureResult', response) + deserialized = self._deserialize('PacketCaptureResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -121,10 +154,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +207,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,25 +225,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -240,18 +253,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -264,10 +320,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -275,25 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Stops a specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop' path_format_arguments = { @@ -319,18 +355,61 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 stop( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Stops a specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +422,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -354,27 +429,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_status( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Query the status of a running packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the Network Watcher resource. - :type network_watcher_name: str - :param packet_capture_name: The name given to the packet capture - session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureQueryStatusResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.PacketCaptureQueryStatusResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_status_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus' path_format_arguments = { @@ -400,18 +457,72 @@ def get_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('PacketCaptureQueryStatusResult', response) + if response.status_code == 202: + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_status( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Query the status of a running packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param packet_capture_name: The name given to the packet capture + session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureQueryStatusResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.PacketCaptureQueryStatusResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -420,12 +531,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) - if response.status_code == 202: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -433,10 +539,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -495,7 +597,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/public_ip_addresses_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/public_ip_addresses_operations.py index 5ea2c25e4084..8c783f0aae1d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/public_ip_addresses_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/public_ip_addresses_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -36,23 +37,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the subnet. - :type public_ip_address_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-06-01" # Construct URL @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the subnet. + :type public_ip_address_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,28 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a static or dynamic public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the public IP address. - :type public_ip_address_name: str - :param parameters: Parameters supplied to the create or update public - IP address operation. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.PublicIPAddress - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PublicIPAddress or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.PublicIPAddress] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2017-06-01" # Construct URL @@ -232,19 +236,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'PublicIPAddress') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PublicIPAddress', response) + if response.status_code == 201: + deserialized = self._deserialize('PublicIPAddress', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public + IP address operation. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.PublicIPAddress + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PublicIPAddress or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.PublicIPAddress] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PublicIPAddress', response) - if response.status_code == 201: - deserialized = self._deserialize('PublicIPAddress', response) + deserialized = self._deserialize('PublicIPAddress', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -324,7 +374,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -393,7 +443,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -467,7 +517,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -550,7 +600,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -631,7 +681,7 @@ def get_virtual_machine_scale_set_public_ip_address( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_filter_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_filter_rules_operations.py index d5ac9c434d7d..e6b12336c365 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_filter_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_filter_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified rule from a route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the rule. - :type rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified rule from a route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the create - or update route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2017_06_01.models.RouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -233,19 +236,77 @@ def create_or_update( body_content = self._serialize.body(route_filter_rule_parameters, 'RouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create + or update route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2017_06_01.models.RouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -254,12 +315,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -267,10 +323,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -278,30 +330,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the update - route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2017_06_01.models.PatchRouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -330,19 +361,75 @@ def update( body_content = self._serialize.body(route_filter_rule_parameters, 'PatchRouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the update + route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2017_06_01.models.PatchRouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -351,10 +438,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -362,10 +446,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -424,7 +504,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_filters_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_filters_operations.py index 36342352c5e9..47d39ecff623 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_filters_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_filters_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the create or - update route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2017_06_01.models.RouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(route_filter_parameters, 'RouteFilter') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or + update route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2017_06_01.models.RouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,28 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the update - route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2017_06_01.models.PatchRouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -322,19 +353,72 @@ def update( body_content = self._serialize.body(route_filter_parameters, 'PatchRouteFilter') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the update + route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2017_06_01.models.PatchRouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +427,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -354,10 +435,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -413,7 +490,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -477,7 +554,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_tables_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_tables_operations.py index a841b4cc43a1..bc3ab3ac8a89 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_tables_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/route_tables_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create or updates a route table in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param parameters: Parameters supplied to the create or update route - table operation. - :type parameters: ~azure.mgmt.network.v2017_06_01.models.RouteTable - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteTable - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.RouteTable] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'RouteTable') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteTable', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route + table operation. + :type parameters: ~azure.mgmt.network.v2017_06_01.models.RouteTable + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteTable + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.RouteTable] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteTable', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteTable', response) + deserialized = self._deserialize('RouteTable', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -320,7 +370,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/routes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/routes_operations.py index af481f0d41cf..1125165d3e41 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/routes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/routes_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route from a route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route from a route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,29 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param route_parameters: Parameters supplied to the create or update - route operation. - :type route_parameters: ~azure.mgmt.network.v2017_06_01.models.Route - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Route or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.Route] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -232,19 +236,76 @@ def create_or_update( body_content = self._serialize.body(route_parameters, 'Route') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Route', response) + if response.status_code == 201: + deserialized = self._deserialize('Route', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update + route operation. + :type route_parameters: ~azure.mgmt.network.v2017_06_01.models.Route + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Route or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.Route] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + route_parameters=route_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +314,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Route', response) - if response.status_code == 201: - deserialized = self._deserialize('Route', response) + deserialized = self._deserialize('Route', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +322,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -328,7 +380,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/security_rules_operations.py index 9b7e1e75c2f0..983a3a013bcb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/security_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,32 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a security rule in the specified network security - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param security_rule_parameters: Parameters supplied to the create or - update network security rule operation. - :type security_rule_parameters: - ~azure.mgmt.network.v2017_06_01.models.SecurityRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns SecurityRule - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.SecurityRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -237,19 +238,79 @@ def create_or_update( body_content = self._serialize.body(security_rule_parameters, 'SecurityRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SecurityRule', response) + if response.status_code == 201: + deserialized = self._deserialize('SecurityRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a security rule in the specified network security + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or + update network security rule operation. + :type security_rule_parameters: + ~azure.mgmt.network.v2017_06_01.models.SecurityRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns SecurityRule + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.SecurityRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + security_rule_parameters=security_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -258,12 +319,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityRule', response) - if response.status_code == 201: - deserialized = self._deserialize('SecurityRule', response) + deserialized = self._deserialize('SecurityRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -271,10 +327,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/subnets_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/subnets_operations.py index 3d52abe1d87d..609c8175c75a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/subnets_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/subnets_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified subnet. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified subnet. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,29 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a subnet in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param subnet_parameters: Parameters supplied to the create or update - subnet operation. - :type subnet_parameters: ~azure.mgmt.network.v2017_06_01.models.Subnet - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Subnet or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.Subnet] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -236,19 +240,76 @@ def create_or_update( body_content = self._serialize.body(subnet_parameters, 'Subnet') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Subnet', response) + if response.status_code == 201: + deserialized = self._deserialize('Subnet', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update + subnet operation. + :type subnet_parameters: ~azure.mgmt.network.v2017_06_01.models.Subnet + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Subnet or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.Subnet] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subnet_parameters=subnet_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -257,12 +318,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Subnet', response) - if response.status_code == 201: - deserialized = self._deserialize('Subnet', response) + deserialized = self._deserialize('Subnet', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -270,10 +326,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -332,7 +384,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/usages_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/usages_operations.py index dd7a1b10e926..1e7607a6354a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/usages_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/usages_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_gateway_connections_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_gateway_connections_operations.py index ad52659f5dd9..579db338e993 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_gateway_connections_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_gateway_connections_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway connection in the - specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param parameters: Parameters supplied to the create or update virtual - network gateway connection operation. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.VirtualNetworkGatewayConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGatewayConnection or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VirtualNetworkGatewayConnection] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGatewayConnection') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway connection in the + specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual + network gateway connection operation. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.VirtualNetworkGatewayConnection + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGatewayConnection or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VirtualNetworkGatewayConnection] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -181,7 +209,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -199,24 +227,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network Gateway connection. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -241,18 +254,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network Gateway connection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -265,10 +319,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -276,30 +326,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): - """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection name. - :type virtual_network_gateway_connection_name: str - :param value: The virtual network connection shared key value. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ConnectionSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionSharedKey(value=value) # Construct URL @@ -329,19 +358,76 @@ def set_shared_key( body_content = self._serialize.body(parameters, 'ConnectionSharedKey') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConnectionSharedKey', response) + if response.status_code == 201: + deserialized = self._deserialize('ConnectionSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection name. + :type virtual_network_gateway_connection_name: str + :param value: The virtual network connection shared key value. + :type value: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ConnectionSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + value=value, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -350,12 +436,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionSharedKey', response) - if response.status_code == 201: - deserialized = self._deserialize('ConnectionSharedKey', response) + deserialized = self._deserialize('ConnectionSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -363,10 +444,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -420,7 +497,7 @@ def get_shared_key( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -487,7 +564,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -506,31 +583,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): - """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection reset shared key Name. - :type virtual_network_gateway_connection_name: str - :param key_length: The virtual network connection reset shared key - length, should between 1 and 128. - :type key_length: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionResetSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ConnectionResetSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionResetSharedKey(key_length=key_length) # Construct URL @@ -560,19 +615,75 @@ def reset_shared_key( body_content = self._serialize.body(parameters, 'ConnectionResetSharedKey') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectionResetSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection reset shared key Name. + :type virtual_network_gateway_connection_name: str + :param key_length: The virtual network connection reset shared key + length, should between 1 and 128. + :type key_length: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionResetSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.ConnectionResetSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + key_length=key_length, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -581,10 +692,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionResetSharedKey', response) + deserialized = self._deserialize('ConnectionResetSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -592,10 +700,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_gateways_operations.py index 1b4c76086760..a9d09dbb7fd5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to create or update virtual - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.VirtualNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.VirtualNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -393,7 +443,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -412,29 +462,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset( - self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): - """Resets the primary of the virtual network gateway in the specified - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param gateway_vip: Virtual network gateway vip address supplied to - the begin reset of the active-active feature enabled gateway. - :type gateway_vip: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_initial( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset' path_format_arguments = { @@ -461,18 +491,72 @@ def reset( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): + """Resets the primary of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param gateway_vip: Virtual network gateway vip address supplied to + the begin reset of the active-active feature enabled gateway. + :type gateway_vip: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + gateway_vip=gateway_vip, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -481,10 +565,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -492,10 +573,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -503,29 +580,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def generatevpnclientpackage( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Generates VPN client package for P2S client of the virtual network - gateway in the specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to the generate virtual network - gateway VPN client package operation. - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.VpnClientParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns str or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _generatevpnclientpackage_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage' path_format_arguments = { @@ -553,54 +610,30 @@ def generatevpnclientpackage( body_content = self._serialize.body(parameters, 'VpnClientParameters') # Construct and send request - def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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 + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - deserialized = None + deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('str', response) + if response.status_code == 200: + deserialized = self._deserialize('str', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - return deserialized + return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - - def generate_vpn_profile( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Generates VPN profile for P2S client of the virtual network gateway in - the specified resource group. Used for IKEV2 and radius based - authentication. + def generatevpnclientpackage( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Generates VPN client package for P2S client of the virtual network + gateway in the specified resource group. :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -620,6 +653,56 @@ def generate_vpn_profile( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + raw_result = self._generatevpnclientpackage_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = self._deserialize('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + + def _generate_vpn_profile_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile' path_format_arguments = { @@ -647,19 +730,74 @@ def generate_vpn_profile( body_content = self._serialize.body(parameters, 'VpnClientParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def generate_vpn_profile( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Generates VPN profile for P2S client of the virtual network gateway in + the specified resource group. Used for IKEV2 and radius based + authentication. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network + gateway VPN client package operation. + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.VpnClientParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns str or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._generate_vpn_profile_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -668,10 +806,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -679,10 +814,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -690,27 +821,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_bgp_peer_status( - self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): - """The GetBgpPeerStatus operation retrieves the status of all BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer to retrieve the status of. - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - BgpPeerStatusListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.BgpPeerStatusListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_bgp_peer_status_initial( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus' path_format_arguments = { @@ -737,18 +850,70 @@ def get_bgp_peer_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('BgpPeerStatusListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_bgp_peer_status( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): + """The GetBgpPeerStatus operation retrieves the status of all BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer to retrieve the status of. + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + BgpPeerStatusListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.BgpPeerStatusListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_bgp_peer_status_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -757,10 +922,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BgpPeerStatusListResult', response) + deserialized = self._deserialize('BgpPeerStatusListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -768,10 +930,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -779,26 +937,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_learned_routes( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - has learned, including routes learned from BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_learned_routes_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes' path_format_arguments = { @@ -823,18 +964,68 @@ def get_learned_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_learned_routes( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + has learned, including routes learned from BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_learned_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -843,10 +1034,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -854,10 +1042,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -865,28 +1049,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_advertised_routes( - self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - is advertising to the specified peer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_advertised_routes_initial( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes' path_format_arguments = { @@ -912,18 +1077,71 @@ def get_advertised_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_advertised_routes( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + is advertising to the specified peer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_advertised_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -932,10 +1150,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -943,10 +1158,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_peerings_operations.py index 66e76c3d4703..d030beda0e8d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_network_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network peering. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the virtual network - peering. - :type virtual_network_peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network + peering. + :type virtual_network_peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the peering. - :type virtual_network_peering_name: str - :param virtual_network_peering_parameters: Parameters supplied to the - create or update virtual network peering operation. - :type virtual_network_peering_parameters: - ~azure.mgmt.network.v2017_06_01.models.VirtualNetworkPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VirtualNetworkPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(virtual_network_peering_parameters, 'VirtualNetworkPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the + create or update virtual network peering operation. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2017_06_01.models.VirtualNetworkPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VirtualNetworkPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + virtual_network_peering_parameters=virtual_network_peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkPeering', response) + deserialized = self._deserialize('VirtualNetworkPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_networks_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_networks_operations.py index b6c16d82e114..6b191d339864 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_networks_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_06_01/operations/virtual_networks_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network in the specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to the create or update virtual - network operation - :type parameters: - ~azure.mgmt.network.v2017_06_01.models.VirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetwork or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VirtualNetwork] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetwork') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetwork', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual + network operation + :type parameters: + ~azure.mgmt.network.v2017_06_01.models.VirtualNetwork + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetwork or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_06_01.models.VirtualNetwork] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetwork', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetwork', response) + deserialized = self._deserialize('VirtualNetwork', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -452,7 +502,7 @@ def check_ip_address_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -521,7 +571,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/address_space.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/address_space.py index 4ff6fb3af6d8..d7050c78a457 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/address_space.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/address_space.py @@ -26,4 +26,5 @@ class AddressSpace(Model): } def __init__(self, address_prefixes=None): + super(AddressSpace, self).__init__() self.address_prefixes = address_prefixes diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_available_waf_rule_sets_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_available_waf_rule_sets_result.py index f746d5769a9e..9b04bae8599d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_available_waf_rule_sets_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_available_waf_rule_sets_result.py @@ -25,4 +25,5 @@ class ApplicationGatewayAvailableWafRuleSetsResult(Model): } def __init__(self, value=None): + super(ApplicationGatewayAvailableWafRuleSetsResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_address.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_address.py index 5ff5ce4b4a5c..6005027d0845 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_address.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_address.py @@ -27,5 +27,6 @@ class ApplicationGatewayBackendAddress(Model): } def __init__(self, fqdn=None, ip_address=None): + super(ApplicationGatewayBackendAddress, self).__init__() self.fqdn = fqdn self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health.py index b8abacea31a1..8901f0ecbcb4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health.py @@ -25,4 +25,5 @@ class ApplicationGatewayBackendHealth(Model): } def __init__(self, backend_address_pools=None): + super(ApplicationGatewayBackendHealth, self).__init__() self.backend_address_pools = backend_address_pools diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_http_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_http_settings.py index 97cf9e2cc295..4be41a52ee4a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_http_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_http_settings.py @@ -30,5 +30,6 @@ class ApplicationGatewayBackendHealthHttpSettings(Model): } def __init__(self, backend_http_settings=None, servers=None): + super(ApplicationGatewayBackendHealthHttpSettings, self).__init__() self.backend_http_settings = backend_http_settings self.servers = servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_pool.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_pool.py index b4b5f9787806..581029a36de8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_pool.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_pool.py @@ -31,5 +31,6 @@ class ApplicationGatewayBackendHealthPool(Model): } def __init__(self, backend_address_pool=None, backend_http_settings_collection=None): + super(ApplicationGatewayBackendHealthPool, self).__init__() self.backend_address_pool = backend_address_pool self.backend_http_settings_collection = backend_http_settings_collection diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_server.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_server.py index 228af5d3eba7..cb2e480ec405 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_server.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_backend_health_server.py @@ -33,6 +33,7 @@ class ApplicationGatewayBackendHealthServer(Model): } def __init__(self, address=None, ip_configuration=None, health=None): + super(ApplicationGatewayBackendHealthServer, self).__init__() self.address = address self.ip_configuration = ip_configuration self.health = health diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_connection_draining.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_connection_draining.py index e1912ca67c62..8f9b88b571e2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_connection_draining.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_connection_draining.py @@ -35,5 +35,6 @@ class ApplicationGatewayConnectionDraining(Model): } def __init__(self, enabled, drain_timeout_in_sec): + super(ApplicationGatewayConnectionDraining, self).__init__() self.enabled = enabled self.drain_timeout_in_sec = drain_timeout_in_sec diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_disabled_rule_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_disabled_rule_group.py index cac1f2bd38e0..02c88980e857 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_disabled_rule_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_disabled_rule_group.py @@ -32,5 +32,6 @@ class ApplicationGatewayFirewallDisabledRuleGroup(Model): } def __init__(self, rule_group_name, rules=None): + super(ApplicationGatewayFirewallDisabledRuleGroup, self).__init__() self.rule_group_name = rule_group_name self.rules = rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_rule.py index 74db98eb4e23..f3f7da7cc11b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_rule.py @@ -31,5 +31,6 @@ class ApplicationGatewayFirewallRule(Model): } def __init__(self, rule_id, description=None): + super(ApplicationGatewayFirewallRule, self).__init__() self.rule_id = rule_id self.description = description diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_rule_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_rule_group.py index d3762415416a..a8d7389128ba 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_rule_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_firewall_rule_group.py @@ -38,6 +38,7 @@ class ApplicationGatewayFirewallRuleGroup(Model): } def __init__(self, rule_group_name, rules, description=None): + super(ApplicationGatewayFirewallRuleGroup, self).__init__() self.rule_group_name = rule_group_name self.description = description self.rules = rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_probe_health_response_match.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_probe_health_response_match.py index 4c8ddb2c0896..beaef556eb99 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_probe_health_response_match.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_probe_health_response_match.py @@ -29,5 +29,6 @@ class ApplicationGatewayProbeHealthResponseMatch(Model): } def __init__(self, body=None, status_codes=None): + super(ApplicationGatewayProbeHealthResponseMatch, self).__init__() self.body = body self.status_codes = status_codes diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_sku.py index 67ce9baca067..f4278d416183 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_sku.py @@ -35,6 +35,7 @@ class ApplicationGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(ApplicationGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_ssl_policy.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_ssl_policy.py index 64f9990e2c80..ede2e626fefc 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_ssl_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_ssl_policy.py @@ -48,6 +48,7 @@ class ApplicationGatewaySslPolicy(Model): } def __init__(self, disabled_ssl_protocols=None, policy_type=None, policy_name=None, cipher_suites=None, min_protocol_version=None): + super(ApplicationGatewaySslPolicy, self).__init__() self.disabled_ssl_protocols = disabled_ssl_protocols self.policy_type = policy_type self.policy_name = policy_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_web_application_firewall_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_web_application_firewall_configuration.py index 4ceacadbbd38..21506000e5f9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_web_application_firewall_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_web_application_firewall_configuration.py @@ -47,6 +47,7 @@ class ApplicationGatewayWebApplicationFirewallConfiguration(Model): } def __init__(self, enabled, firewall_mode, rule_set_type, rule_set_version, disabled_rule_groups=None): + super(ApplicationGatewayWebApplicationFirewallConfiguration, self).__init__() self.enabled = enabled self.firewall_mode = firewall_mode self.rule_set_type = rule_set_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/azure_async_operation_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/azure_async_operation_result.py index 0d74009c2e5c..cb7bc721967b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/azure_async_operation_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/azure_async_operation_result.py @@ -37,5 +37,6 @@ class AzureAsyncOperationResult(Model): } def __init__(self, status=None, error=None): + super(AzureAsyncOperationResult, self).__init__() self.status = status self.error = error diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_community.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_community.py index b80621009023..8275a0e4048c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_community.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_community.py @@ -43,6 +43,7 @@ class BGPCommunity(Model): } def __init__(self, service_supported_region=None, community_name=None, community_value=None, community_prefixes=None, is_authorized_to_use=None, service_group=None): + super(BGPCommunity, self).__init__() self.service_supported_region = service_supported_region self.community_name = community_name self.community_value = community_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_peer_status.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_peer_status.py index 3e452fe5e57e..a6b4cf0460df 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_peer_status.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_peer_status.py @@ -60,6 +60,7 @@ class BgpPeerStatus(Model): } def __init__(self): + super(BgpPeerStatus, self).__init__() self.local_address = None self.neighbor = None self.asn = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_peer_status_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_peer_status_list_result.py index 992629b5a9da..f99a5723974e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_peer_status_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_peer_status_list_result.py @@ -24,4 +24,5 @@ class BgpPeerStatusListResult(Model): } def __init__(self, value=None): + super(BgpPeerStatusListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_settings.py index d62cc30ab0c7..c5730da2e43e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/bgp_settings.py @@ -32,6 +32,7 @@ class BgpSettings(Model): } def __init__(self, asn=None, bgp_peering_address=None, peer_weight=None): + super(BgpSettings, self).__init__() self.asn = asn self.bgp_peering_address = bgp_peering_address self.peer_weight = peer_weight diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connection_reset_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connection_reset_shared_key.py index 10bfdc9ba17d..3338112a7fe7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connection_reset_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connection_reset_shared_key.py @@ -29,4 +29,5 @@ class ConnectionResetSharedKey(Model): } def __init__(self, key_length): + super(ConnectionResetSharedKey, self).__init__() self.key_length = key_length diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connection_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connection_shared_key.py index 0dbbc36cc798..2c1b0ed9a914 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connection_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connection_shared_key.py @@ -28,4 +28,5 @@ class ConnectionSharedKey(Model): } def __init__(self, value): + super(ConnectionSharedKey, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_destination.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_destination.py index 756dfadfdd49..cd0e8818b591 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_destination.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_destination.py @@ -32,6 +32,7 @@ class ConnectivityDestination(Model): } def __init__(self, resource_id=None, address=None, port=None): + super(ConnectivityDestination, self).__init__() self.resource_id = resource_id self.address = address self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_hop.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_hop.py index e30dcae2a8ad..02dd43082524 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_hop.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_hop.py @@ -52,6 +52,7 @@ class ConnectivityHop(Model): } def __init__(self): + super(ConnectivityHop, self).__init__() self.type = None self.id = None self.address = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_information.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_information.py index fa320c1a3c94..5056e41af09c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_information.py @@ -58,6 +58,7 @@ class ConnectivityInformation(Model): } def __init__(self): + super(ConnectivityInformation, self).__init__() self.hops = None self.connection_status = None self.avg_latency_in_ms = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_issue.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_issue.py index 9dcfeca84ad5..937d8e5f5f73 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_issue.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_issue.py @@ -48,6 +48,7 @@ class ConnectivityIssue(Model): } def __init__(self): + super(ConnectivityIssue, self).__init__() self.origin = None self.severity = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_parameters.py index 956a41fc09b0..6e500c4f42df 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_parameters.py @@ -33,5 +33,6 @@ class ConnectivityParameters(Model): } def __init__(self, source, destination): + super(ConnectivityParameters, self).__init__() self.source = source self.destination = destination diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_source.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_source.py index 8c7034e63c32..c42bfc0aa09d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_source.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/connectivity_source.py @@ -33,5 +33,6 @@ class ConnectivitySource(Model): } def __init__(self, resource_id, port=None): + super(ConnectivitySource, self).__init__() self.resource_id = resource_id self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/dhcp_options.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/dhcp_options.py index 2262eb5ec2f1..8744ba6fc9b1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/dhcp_options.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/dhcp_options.py @@ -26,4 +26,5 @@ class DhcpOptions(Model): } def __init__(self, dns_servers=None): + super(DhcpOptions, self).__init__() self.dns_servers = dns_servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/dns_name_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/dns_name_availability_result.py index 4be1851d2f59..15a0238e49a7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/dns_name_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/dns_name_availability_result.py @@ -24,4 +24,5 @@ class DnsNameAvailabilityResult(Model): } def __init__(self, available=None): + super(DnsNameAvailabilityResult, self).__init__() self.available = available diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group.py index 2dee96cfca86..300a7c89eca0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group.py @@ -38,6 +38,7 @@ class EffectiveNetworkSecurityGroup(Model): } def __init__(self, network_security_group=None, association=None, effective_security_rules=None, tag_map=None): + super(EffectiveNetworkSecurityGroup, self).__init__() self.network_security_group = network_security_group self.association = association self.effective_security_rules = effective_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group_association.py index bc239f28f77d..9367eb66be0f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group_association.py @@ -28,5 +28,6 @@ class EffectiveNetworkSecurityGroupAssociation(Model): } def __init__(self, subnet=None, network_interface=None): + super(EffectiveNetworkSecurityGroupAssociation, self).__init__() self.subnet = subnet self.network_interface = network_interface diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group_list_result.py index e09ce6d0ef07..e8f948ff1da4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_group_list_result.py @@ -35,5 +35,6 @@ class EffectiveNetworkSecurityGroupListResult(Model): } def __init__(self, value=None): + super(EffectiveNetworkSecurityGroupListResult, self).__init__() self.value = value self.next_link = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_rule.py index dbc76fedf3f4..2c58ef9fb5d4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_network_security_rule.py @@ -83,6 +83,7 @@ class EffectiveNetworkSecurityRule(Model): } def __init__(self, name=None, protocol=None, source_port_range=None, destination_port_range=None, source_port_ranges=None, destination_port_ranges=None, source_address_prefix=None, destination_address_prefix=None, source_address_prefixes=None, destination_address_prefixes=None, expanded_source_address_prefix=None, expanded_destination_address_prefix=None, access=None, priority=None, direction=None): + super(EffectiveNetworkSecurityRule, self).__init__() self.name = name self.protocol = protocol self.source_port_range = source_port_range diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_route.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_route.py index 572608f06e63..cc11b4a98ffa 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_route.py @@ -51,6 +51,7 @@ class EffectiveRoute(Model): } def __init__(self, name=None, source=None, state=None, address_prefix=None, next_hop_ip_address=None, next_hop_type=None): + super(EffectiveRoute, self).__init__() self.name = name self.source = source self.state = state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_route_list_result.py index 4adc9a0e4ce3..579377f54077 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/effective_route_list_result.py @@ -34,5 +34,6 @@ class EffectiveRouteListResult(Model): } def __init__(self, value=None): + super(EffectiveRouteListResult, self).__init__() self.value = value self.next_link = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/error.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/error.py index 54e2f704aa25..65154ab6fd14 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/error.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/error.py @@ -36,6 +36,7 @@ class Error(Model): } def __init__(self, code=None, message=None, target=None, details=None, inner_error=None): + super(Error, self).__init__() self.code = code self.message = message self.target = target diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/error_details.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/error_details.py index 47f2ac4111b1..40bea00aa2fb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/error_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/error_details.py @@ -30,6 +30,7 @@ class ErrorDetails(Model): } def __init__(self, code=None, target=None, message=None): + super(ErrorDetails, self).__init__() self.code = code self.target = target self.message = message diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_arp_table.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_arp_table.py index a2f8f716bf8a..ace325747ee5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_arp_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_arp_table.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitArpTable(Model): } def __init__(self, age=None, interface=None, ip_address=None, mac_address=None): + super(ExpressRouteCircuitArpTable, self).__init__() self.age = age self.interface = interface self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_peering_config.py index 595426d6df73..37911fd41328 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_peering_config.py @@ -46,6 +46,7 @@ class ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, advertised_public_prefixes=None, advertised_communities=None, advertised_public_prefixes_state=None, legacy_mode=None, customer_asn=None, routing_registry_name=None): + super(ExpressRouteCircuitPeeringConfig, self).__init__() self.advertised_public_prefixes = advertised_public_prefixes self.advertised_communities = advertised_communities self.advertised_public_prefixes_state = advertised_public_prefixes_state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_routes_table.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_routes_table.py index e84fae6e0973..804d29a2f9bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_routes_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_routes_table.py @@ -36,6 +36,7 @@ class ExpressRouteCircuitRoutesTable(Model): } def __init__(self, network=None, next_hop=None, loc_prf=None, weight=None, path=None): + super(ExpressRouteCircuitRoutesTable, self).__init__() self.network = network self.next_hop = next_hop self.loc_prf = loc_prf diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_routes_table_summary.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_routes_table_summary.py index 3ff1b42d0c1b..6f5f89764dd4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_routes_table_summary.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_routes_table_summary.py @@ -38,6 +38,7 @@ class ExpressRouteCircuitRoutesTableSummary(Model): } def __init__(self, neighbor=None, v=None, as_property=None, up_down=None, state_pfx_rcd=None): + super(ExpressRouteCircuitRoutesTableSummary, self).__init__() self.neighbor = neighbor self.v = v self.as_property = as_property diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_service_provider_properties.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_service_provider_properties.py index b7ada851e235..7a6b4ba96061 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_service_provider_properties.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_service_provider_properties.py @@ -30,6 +30,7 @@ class ExpressRouteCircuitServiceProviderProperties(Model): } def __init__(self, service_provider_name=None, peering_location=None, bandwidth_in_mbps=None): + super(ExpressRouteCircuitServiceProviderProperties, self).__init__() self.service_provider_name = service_provider_name self.peering_location = peering_location self.bandwidth_in_mbps = bandwidth_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_sku.py index fff140361edc..3d9535a7b4f2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_sku.py @@ -34,6 +34,7 @@ class ExpressRouteCircuitSku(Model): } def __init__(self, name=None, tier=None, family=None): + super(ExpressRouteCircuitSku, self).__init__() self.name = name self.tier = tier self.family = family diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_stats.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_stats.py index 1215bda40383..e26f6f7d2f74 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_stats.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuit_stats.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitStats(Model): } def __init__(self, primarybytes_in=None, primarybytes_out=None, secondarybytes_in=None, secondarybytes_out=None): + super(ExpressRouteCircuitStats, self).__init__() self.primarybytes_in = primarybytes_in self.primarybytes_out = primarybytes_out self.secondarybytes_in = secondarybytes_in diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_arp_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_arp_table_list_result.py index 395f95916762..cb35833ea786 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_arp_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_arp_table_list_result.py @@ -28,5 +28,6 @@ class ExpressRouteCircuitsArpTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsArpTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_routes_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_routes_table_list_result.py index ca880d3d17b1..0e4a0a4458f6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_routes_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_routes_table_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_routes_table_summary_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_routes_table_summary_list_result.py index 8f9bc6200a69..a4821ae5dd15 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_routes_table_summary_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_circuits_routes_table_summary_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableSummaryListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableSummaryListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_service_provider_bandwidths_offered.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_service_provider_bandwidths_offered.py index b1b2c8a76447..9cbba2fcfe97 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_service_provider_bandwidths_offered.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/express_route_service_provider_bandwidths_offered.py @@ -27,5 +27,6 @@ class ExpressRouteServiceProviderBandwidthsOffered(Model): } def __init__(self, offer_name=None, value_in_mbps=None): + super(ExpressRouteServiceProviderBandwidthsOffered, self).__init__() self.offer_name = offer_name self.value_in_mbps = value_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/flow_log_information.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/flow_log_information.py index b3e483aa64f0..adc3f12ea653 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/flow_log_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/flow_log_information.py @@ -42,6 +42,7 @@ class FlowLogInformation(Model): } def __init__(self, target_resource_id, storage_id, enabled, retention_policy=None): + super(FlowLogInformation, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/flow_log_status_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/flow_log_status_parameters.py index 1dae2ff24447..4cd22222bb45 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/flow_log_status_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/flow_log_status_parameters.py @@ -29,4 +29,5 @@ class FlowLogStatusParameters(Model): } def __init__(self, target_resource_id): + super(FlowLogStatusParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/gateway_route.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/gateway_route.py index d3e0d4163c35..64a53f146c0b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/gateway_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/gateway_route.py @@ -55,6 +55,7 @@ class GatewayRoute(Model): } def __init__(self): + super(GatewayRoute, self).__init__() self.local_address = None self.network = None self.next_hop = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/gateway_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/gateway_route_list_result.py index 9310c4114bc0..31f26ed44436 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/gateway_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/gateway_route_list_result.py @@ -24,4 +24,5 @@ class GatewayRouteListResult(Model): } def __init__(self, value=None): + super(GatewayRouteListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ip_address_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ip_address_availability_result.py index 0e26dd91fffc..f2cb36a550ec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ip_address_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ip_address_availability_result.py @@ -28,5 +28,6 @@ class IPAddressAvailabilityResult(Model): } def __init__(self, available=None, available_ip_addresses=None): + super(IPAddressAvailabilityResult, self).__init__() self.available = available self.available_ip_addresses = available_ip_addresses diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ipsec_policy.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ipsec_policy.py index 574749c35ad6..b8e9f75e0830 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ipsec_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ipsec_policy.py @@ -74,6 +74,7 @@ class IpsecPolicy(Model): } def __init__(self, sa_life_time_seconds, sa_data_size_kilobytes, ipsec_encryption, ipsec_integrity, ike_encryption, ike_integrity, dh_group, pfs_group): + super(IpsecPolicy, self).__init__() self.sa_life_time_seconds = sa_life_time_seconds self.sa_data_size_kilobytes = sa_data_size_kilobytes self.ipsec_encryption = ipsec_encryption diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ipv6_express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ipv6_express_route_circuit_peering_config.py index 892d0125bdce..2ae9ce968dca 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ipv6_express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/ipv6_express_route_circuit_peering_config.py @@ -39,6 +39,7 @@ class Ipv6ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, primary_peer_address_prefix=None, secondary_peer_address_prefix=None, microsoft_peering_config=None, route_filter=None, state=None): + super(Ipv6ExpressRouteCircuitPeeringConfig, self).__init__() self.primary_peer_address_prefix = primary_peer_address_prefix self.secondary_peer_address_prefix = secondary_peer_address_prefix self.microsoft_peering_config = microsoft_peering_config diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/load_balancer_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/load_balancer_sku.py index 83e09b1a95ce..a80a46924ee3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/load_balancer_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/load_balancer_sku.py @@ -26,4 +26,5 @@ class LoadBalancerSku(Model): } def __init__(self, name=None): + super(LoadBalancerSku, self).__init__() self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/network_interface_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/network_interface_association.py index a5770f9f3e37..8c8928c70cfa 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/network_interface_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/network_interface_association.py @@ -35,5 +35,6 @@ class NetworkInterfaceAssociation(Model): } def __init__(self, security_rules=None): + super(NetworkInterfaceAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/network_interface_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/network_interface_dns_settings.py index 110594c2f928..675a4a1eb08a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/network_interface_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/network_interface_dns_settings.py @@ -47,6 +47,7 @@ class NetworkInterfaceDnsSettings(Model): } def __init__(self, dns_servers=None, applied_dns_servers=None, internal_dns_name_label=None, internal_fqdn=None, internal_domain_name_suffix=None): + super(NetworkInterfaceDnsSettings, self).__init__() self.dns_servers = dns_servers self.applied_dns_servers = applied_dns_servers self.internal_dns_name_label = internal_dns_name_label diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/next_hop_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/next_hop_parameters.py index f38a8ce62abb..3e1478409a0a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/next_hop_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/next_hop_parameters.py @@ -42,6 +42,7 @@ class NextHopParameters(Model): } def __init__(self, target_resource_id, source_ip_address, destination_ip_address, target_nic_resource_id=None): + super(NextHopParameters, self).__init__() self.target_resource_id = target_resource_id self.source_ip_address = source_ip_address self.destination_ip_address = destination_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/next_hop_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/next_hop_result.py index 53ed05bc4451..111c214ec708 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/next_hop_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/next_hop_result.py @@ -36,6 +36,7 @@ class NextHopResult(Model): } def __init__(self, next_hop_type=None, next_hop_ip_address=None, route_table_id=None): + super(NextHopResult, self).__init__() self.next_hop_type = next_hop_type self.next_hop_ip_address = next_hop_ip_address self.route_table_id = route_table_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture.py index ee2a52c1aea2..2af0db758e08 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture.py @@ -50,6 +50,7 @@ class PacketCapture(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCapture, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_filter.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_filter.py index 6f6aaa104c9f..0c7d35db0de3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_filter.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_filter.py @@ -52,6 +52,7 @@ class PacketCaptureFilter(Model): } def __init__(self, protocol="Any", local_ip_address=None, remote_ip_address=None, local_port=None, remote_port=None): + super(PacketCaptureFilter, self).__init__() self.protocol = protocol self.local_ip_address = local_ip_address self.remote_ip_address = remote_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_parameters.py index cd120ced2489..773b63d290f8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_parameters.py @@ -50,6 +50,7 @@ class PacketCaptureParameters(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCaptureParameters, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_query_status_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_query_status_result.py index 185e85e8d53f..d892135545b1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_query_status_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_query_status_result.py @@ -44,6 +44,7 @@ class PacketCaptureQueryStatusResult(Model): } def __init__(self, name=None, id=None, capture_start_time=None, packet_capture_status=None, stop_reason=None, packet_capture_error=None): + super(PacketCaptureQueryStatusResult, self).__init__() self.name = name self.id = id self.capture_start_time = capture_start_time diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_result.py index 7cb42e51d8b2..f8342856187d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_result.py @@ -71,6 +71,7 @@ class PacketCaptureResult(Model): } def __init__(self, target, storage_location, etag="A unique read-only string that changes whenever the resource is updated.", bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None, provisioning_state=None): + super(PacketCaptureResult, self).__init__() self.name = None self.id = None self.etag = etag diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_storage_location.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_storage_location.py index d0987d11ff9f..773b04d22501 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_storage_location.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_storage_location.py @@ -36,6 +36,7 @@ class PacketCaptureStorageLocation(Model): } def __init__(self, storage_id=None, storage_path=None, file_path=None): + super(PacketCaptureStorageLocation, self).__init__() self.storage_id = storage_id self.storage_path = storage_path self.file_path = file_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/public_ip_address_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/public_ip_address_dns_settings.py index 65a534407848..a248461f05d7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/public_ip_address_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/public_ip_address_dns_settings.py @@ -39,6 +39,7 @@ class PublicIPAddressDnsSettings(Model): } def __init__(self, domain_name_label=None, fqdn=None, reverse_fqdn=None): + super(PublicIPAddressDnsSettings, self).__init__() self.domain_name_label = domain_name_label self.fqdn = fqdn self.reverse_fqdn = reverse_fqdn diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/public_ip_address_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/public_ip_address_sku.py index 8ae254216067..f2ef83f4e96c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/public_ip_address_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/public_ip_address_sku.py @@ -26,4 +26,5 @@ class PublicIPAddressSku(Model): } def __init__(self, name=None): + super(PublicIPAddressSku, self).__init__() self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/query_troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/query_troubleshooting_parameters.py index a394b181fcc5..9b6801eb7b63 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/query_troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/query_troubleshooting_parameters.py @@ -29,4 +29,5 @@ class QueryTroubleshootingParameters(Model): } def __init__(self, target_resource_id): + super(QueryTroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/resource.py index ef9699426827..ff5f1f40e14e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/resource.py @@ -44,6 +44,7 @@ class Resource(Model): } def __init__(self, id=None, location=None, tags=None): + super(Resource, self).__init__() self.id = id self.name = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/retention_policy_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/retention_policy_parameters.py index 58f7f12cc6a9..102f4c5c3b4c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/retention_policy_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/retention_policy_parameters.py @@ -27,5 +27,6 @@ class RetentionPolicyParameters(Model): } def __init__(self, days=0, enabled=False): + super(RetentionPolicyParameters, self).__init__() self.days = days self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_network_interface.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_network_interface.py index c667f24df4a3..4b0a64691a47 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_network_interface.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_network_interface.py @@ -28,5 +28,6 @@ class SecurityGroupNetworkInterface(Model): } def __init__(self, id=None, security_rule_associations=None): + super(SecurityGroupNetworkInterface, self).__init__() self.id = id self.security_rule_associations = security_rule_associations diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_view_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_view_parameters.py index 304908dd4792..5c0972e5d55e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_view_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_view_parameters.py @@ -28,4 +28,5 @@ class SecurityGroupViewParameters(Model): } def __init__(self, target_resource_id): + super(SecurityGroupViewParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_view_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_view_result.py index 863844e91767..06cd47eb7068 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_view_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_group_view_result.py @@ -25,4 +25,5 @@ class SecurityGroupViewResult(Model): } def __init__(self, network_interfaces=None): + super(SecurityGroupViewResult, self).__init__() self.network_interfaces = network_interfaces diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_rule.py index aae11e9d1b9a..fd6357c82a90 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_rule.py @@ -101,7 +101,7 @@ class SecurityRule(SubResource): 'etag': {'key': 'etag', 'type': 'str'}, } - def __init__(self, protocol, source_address_prefix=None, destination_address_prefix=None, access=None, direction=None, id=None, description=None, source_port_range=None, destination_port_range=None, source_address_prefixes=None, destination_address_prefixes=None, source_port_ranges=None, destination_port_ranges=None, priority=None, provisioning_state=None, name=None, etag=None): + def __init__(self, protocol, access, direction, id=None, description=None, source_port_range=None, destination_port_range=None, source_address_prefix=None, source_address_prefixes=None, destination_address_prefix=None, destination_address_prefixes=None, source_port_ranges=None, destination_port_ranges=None, priority=None, provisioning_state=None, name=None, etag=None): super(SecurityRule, self).__init__(id=id) self.description = description self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_rule_associations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_rule_associations.py index 8263bbd727ce..8df7e8aa4db7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_rule_associations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/security_rule_associations.py @@ -38,6 +38,7 @@ class SecurityRuleAssociations(Model): } def __init__(self, network_interface_association=None, subnet_association=None, default_security_rules=None, effective_security_rules=None): + super(SecurityRuleAssociations, self).__init__() self.network_interface_association = network_interface_association self.subnet_association = subnet_association self.default_security_rules = default_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/service_endpoint_properties_format.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/service_endpoint_properties_format.py index 0168d03284a9..847cb9ac8b3b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/service_endpoint_properties_format.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/service_endpoint_properties_format.py @@ -30,6 +30,7 @@ class ServiceEndpointPropertiesFormat(Model): } def __init__(self, service=None, locations=None, provisioning_state=None): + super(ServiceEndpointPropertiesFormat, self).__init__() self.service = service self.locations = locations self.provisioning_state = provisioning_state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/sub_resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/sub_resource.py index b23dc42afd0e..491f1d1caf83 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/sub_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/sub_resource.py @@ -24,4 +24,5 @@ class SubResource(Model): } def __init__(self, id=None): + super(SubResource, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/subnet_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/subnet_association.py index 6a2db5304cef..a873d76f0217 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/subnet_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/subnet_association.py @@ -35,5 +35,6 @@ class SubnetAssociation(Model): } def __init__(self, security_rules=None): + super(SubnetAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology.py index 8a11ad220102..3adfa74a0e60 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology.py @@ -44,6 +44,7 @@ class Topology(Model): } def __init__(self, resources=None): + super(Topology, self).__init__() self.id = None self.created_date_time = None self.last_modified = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_association.py index cf1c5533daac..1f14e581194a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_association.py @@ -34,6 +34,7 @@ class TopologyAssociation(Model): } def __init__(self, name=None, resource_id=None, association_type=None): + super(TopologyAssociation, self).__init__() self.name = name self.resource_id = resource_id self.association_type = association_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_parameters.py index c2f674cad7fc..04920dc9665d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_parameters.py @@ -29,4 +29,5 @@ class TopologyParameters(Model): } def __init__(self, target_resource_group_name): + super(TopologyParameters, self).__init__() self.target_resource_group_name = target_resource_group_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_resource.py index ef014c81dbaa..17f968c22c06 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/topology_resource.py @@ -35,6 +35,7 @@ class TopologyResource(Model): } def __init__(self, name=None, id=None, location=None, associations=None): + super(TopologyResource, self).__init__() self.name = name self.id = id self.location = location diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_details.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_details.py index f8b797dfbba0..98555e3482d3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_details.py @@ -37,6 +37,7 @@ class TroubleshootingDetails(Model): } def __init__(self, id=None, reason_type=None, summary=None, detail=None, recommended_actions=None): + super(TroubleshootingDetails, self).__init__() self.id = id self.reason_type = reason_type self.summary = summary diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_parameters.py index d6bd7ebe04e6..c4833fb8eeb3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_parameters.py @@ -38,6 +38,7 @@ class TroubleshootingParameters(Model): } def __init__(self, target_resource_id, storage_id, storage_path): + super(TroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.storage_path = storage_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_recommended_actions.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_recommended_actions.py index 479eb32b8fa8..cbc5e31177c7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_recommended_actions.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_recommended_actions.py @@ -35,6 +35,7 @@ class TroubleshootingRecommendedActions(Model): } def __init__(self, action_id=None, action_text=None, action_uri=None, action_uri_text=None): + super(TroubleshootingRecommendedActions, self).__init__() self.action_id = action_id self.action_text = action_text self.action_uri = action_uri diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_result.py index ad3a0de89f58..78d42387bcd8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/troubleshooting_result.py @@ -34,6 +34,7 @@ class TroubleshootingResult(Model): } def __init__(self, start_time=None, end_time=None, code=None, results=None): + super(TroubleshootingResult, self).__init__() self.start_time = start_time self.end_time = end_time self.code = code diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/tunnel_connection_health.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/tunnel_connection_health.py index 51b2a0bf2473..05307b23676e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/tunnel_connection_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/tunnel_connection_health.py @@ -53,6 +53,7 @@ class TunnelConnectionHealth(Model): } def __init__(self): + super(TunnelConnectionHealth, self).__init__() self.tunnel = None self.connection_status = None self.ingress_bytes_transferred = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/usage.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/usage.py index 9ed2eb18cdfe..e70f2be17cc4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/usage.py @@ -50,6 +50,7 @@ class Usage(Model): unit = "Count" def __init__(self, current_value, limit, name): + super(Usage, self).__init__() self.id = None self.current_value = current_value self.limit = limit diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/usage_name.py index 87786b60cf62..df7f344bfb9b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/usage_name.py @@ -27,5 +27,6 @@ class UsageName(Model): } def __init__(self, value=None, localized_value=None): + super(UsageName, self).__init__() self.value = value self.localized_value = localized_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/verification_ip_flow_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/verification_ip_flow_parameters.py index 60eb43b6fb21..532be214d2f5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/verification_ip_flow_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/verification_ip_flow_parameters.py @@ -66,6 +66,7 @@ class VerificationIPFlowParameters(Model): } def __init__(self, target_resource_id, direction, protocol, local_port, remote_port, local_ip_address, remote_ip_address, target_nic_resource_id=None): + super(VerificationIPFlowParameters, self).__init__() self.target_resource_id = target_resource_id self.direction = direction self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/verification_ip_flow_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/verification_ip_flow_result.py index e6fefdbc0a8f..63f5e3b94516 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/verification_ip_flow_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/verification_ip_flow_result.py @@ -29,5 +29,6 @@ class VerificationIPFlowResult(Model): } def __init__(self, access=None, rule_name=None): + super(VerificationIPFlowResult, self).__init__() self.access = access self.rule_name = rule_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_connection_gateway_reference.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_connection_gateway_reference.py index f50295906ad8..eb18a3c124ff 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_connection_gateway_reference.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_connection_gateway_reference.py @@ -29,4 +29,5 @@ class VirtualNetworkConnectionGatewayReference(Model): } def __init__(self, id): + super(VirtualNetworkConnectionGatewayReference, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_gateway_sku.py index 0776d22357be..0bb4234db59e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_gateway_sku.py @@ -36,6 +36,7 @@ class VirtualNetworkGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(VirtualNetworkGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_usage.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_usage.py index 697ec07a1e61..dce105d9280f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_usage.py @@ -48,6 +48,7 @@ class VirtualNetworkUsage(Model): } def __init__(self): + super(VirtualNetworkUsage, self).__init__() self.current_value = None self.id = None self.limit = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_usage_name.py index dd93c0846a5c..01fcbf0875eb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_usage_name.py @@ -35,5 +35,6 @@ class VirtualNetworkUsageName(Model): } def __init__(self): + super(VirtualNetworkUsageName, self).__init__() self.localized_value = None self.value = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/vpn_client_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/vpn_client_configuration.py index fa91bb58e4cf..5e27eec921a8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/vpn_client_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/vpn_client_configuration.py @@ -49,6 +49,7 @@ class VpnClientConfiguration(Model): } def __init__(self, vpn_client_address_pool=None, vpn_client_root_certificates=None, vpn_client_revoked_certificates=None, vpn_client_protocols=None, radius_server_address=None, radius_server_secret=None): + super(VpnClientConfiguration, self).__init__() self.vpn_client_address_pool = vpn_client_address_pool self.vpn_client_root_certificates = vpn_client_root_certificates self.vpn_client_revoked_certificates = vpn_client_revoked_certificates diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/vpn_client_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/vpn_client_parameters.py index f4f82a7a6cc1..1792cc36c432 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/vpn_client_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/vpn_client_parameters.py @@ -43,6 +43,7 @@ class VpnClientParameters(Model): } def __init__(self, processor_architecture=None, authentication_method=None, radius_server_auth_certificate=None, client_root_certificates=None): + super(VpnClientParameters, self).__init__() self.processor_architecture = processor_architecture self.authentication_method = authentication_method self.radius_server_auth_certificate = radius_server_auth_certificate diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/network_management_client.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/network_management_client.py index 1caa59a62c83..58dd420e4c74 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/network_management_client.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/network_management_client.py @@ -301,7 +301,7 @@ def check_dns_name_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/application_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/application_gateways_operations.py index ec2aa20e9f17..3e5da444d859 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/application_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/application_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param parameters: Parameters supplied to the create or update - application gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.ApplicationGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ApplicationGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ApplicationGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update + application gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.ApplicationGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ApplicationGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('ApplicationGateway', response) + deserialized = self._deserialize('ApplicationGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -381,7 +431,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -400,23 +450,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def start( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Starts the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _start_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start' path_format_arguments = { @@ -441,18 +477,58 @@ def start( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 start( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Starts the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._start_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -465,10 +541,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -476,23 +548,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Stops the specified application gateway in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop' path_format_arguments = { @@ -517,18 +575,58 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def stop( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Stops the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -541,10 +639,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -552,28 +646,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def backend_health( - self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Gets the backend health of the specified application gateway in a - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param expand: Expands BackendAddressPool and BackendHttpSettings - referenced in backend health. - :type expand: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGatewayBackendHealth or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ApplicationGatewayBackendHealth] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _backend_health_initial( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth' path_format_arguments = { @@ -600,18 +675,71 @@ def backend_health( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ApplicationGatewayBackendHealth', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def backend_health( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets the backend health of the specified application gateway in a + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param expand: Expands BackendAddressPool and BackendHttpSettings + referenced in backend health. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGatewayBackendHealth or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ApplicationGatewayBackendHealth] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._backend_health_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + expand=expand, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -620,10 +748,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) + deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -631,10 +756,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -681,7 +802,7 @@ def list_available_waf_rule_sets( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -738,7 +859,7 @@ def list_available_ssl_options( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -802,7 +923,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -863,7 +984,7 @@ def get_ssl_predefined_policy( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/available_endpoint_services_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/available_endpoint_services_operations.py index 89d0eb8573e8..5db20193a4e6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/available_endpoint_services_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/available_endpoint_services_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/bgp_service_communities_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/bgp_service_communities_operations.py index 8aae98c638fb..8098b3949b91 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/bgp_service_communities_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/bgp_service_communities_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/default_security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/default_security_rules_operations.py index 25733bc94315..512ca6df14f5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/default_security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/default_security_rules_operations.py @@ -89,7 +89,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -156,7 +156,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuit_authorizations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuit_authorizations_operations.py index 84fc0dfaa286..f5118ca30e28 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuit_authorizations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuit_authorizations_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified authorization from the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified authorization from the specified express route + circuit. - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,31 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an authorization in the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param authorization_parameters: Parameters supplied to the create or - update express route circuit authorization operation. - :type authorization_parameters: - ~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitAuthorization - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitAuthorization] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -238,19 +240,78 @@ def create_or_update( body_content = self._serialize.body(authorization_parameters, 'ExpressRouteCircuitAuthorization') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization in the specified express route + circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or + update express route circuit authorization operation. + :type authorization_parameters: + ~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitAuthorization + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitAuthorization] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + authorization_parameters=authorization_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -259,12 +320,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -272,10 +328,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuit_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuit_peerings_operations.py index faef79b0184b..131af7c36380 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuit_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuit_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified peering from the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified peering from the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified express route circuits. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param peering_parameters: Parameters supplied to the create or update - express route circuit peering operation. - :type peering_parameters: - ~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(peering_parameters, 'ExpressRouteCircuitPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + express route circuit peering operation. + :type peering_parameters: + ~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + peering_parameters=peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuits_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuits_operations.py index da7198a570d5..90b4d8d503bf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuits_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_circuits_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the circuit. - :type circuit_name: str - :param parameters: Parameters supplied to the create or update express - route circuit operation. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuit - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuit or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuit] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ExpressRouteCircuit') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuit', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuit', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the circuit. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express + route circuit operation. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuit + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuit or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuit] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuit', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuit', response) + deserialized = self._deserialize('ExpressRouteCircuit', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -269,30 +319,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_arp_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised ARP table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsArpTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitsArpTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_arp_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}' path_format_arguments = { @@ -319,18 +348,74 @@ def list_arp_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ExpressRouteCircuitsArpTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_arp_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised ARP table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsArpTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitsArpTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_arp_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -339,10 +424,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -350,10 +432,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -361,30 +439,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitsRoutesTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}' path_format_arguments = { @@ -411,18 +468,74 @@ def list_routes_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsRoutesTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitsRoutesTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -431,10 +544,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -442,10 +552,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -453,30 +559,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table_summary( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table summary associated with the - express route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse - if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_summary_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}' path_format_arguments = { @@ -503,18 +588,74 @@ def list_routes_table_summary( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table_summary( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table summary associated with the + express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse + if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -523,10 +664,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -534,10 +672,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -589,7 +723,7 @@ def get_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -654,7 +788,7 @@ def get_peering_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -720,7 +854,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -784,7 +918,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_service_providers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_service_providers_operations.py index 8bb2147726fd..f08e9d3ef2d6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_service_providers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/express_route_service_providers_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/inbound_nat_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/inbound_nat_rules_operations.py index 4465e91aa450..e1437add9365 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/inbound_nat_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/inbound_nat_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -108,25 +109,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def delete( - self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer inbound nat rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param inbound_nat_rule_name: The name of the inbound nat rule. - :type inbound_nat_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}' path_format_arguments = { @@ -152,18 +137,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer inbound nat rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound nat rule. + :type inbound_nat_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -176,10 +204,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -237,7 +261,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -255,30 +279,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer inbound nat rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param inbound_nat_rule_name: The name of the inbound nat rule. - :type inbound_nat_rule_name: str - :param inbound_nat_rule_parameters: Parameters supplied to the create - or update inbound nat rule operation. - :type inbound_nat_rule_parameters: - ~azure.mgmt.network.v2017_08_01.models.InboundNatRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - InboundNatRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.InboundNatRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}' path_format_arguments = { @@ -307,19 +310,77 @@ def create_or_update( body_content = self._serialize.body(inbound_nat_rule_parameters, 'InboundNatRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('InboundNatRule', response) + if response.status_code == 201: + deserialized = self._deserialize('InboundNatRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer inbound nat rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound nat rule. + :type inbound_nat_rule_name: str + :param inbound_nat_rule_parameters: Parameters supplied to the create + or update inbound nat rule operation. + :type inbound_nat_rule_parameters: + ~azure.mgmt.network.v2017_08_01.models.InboundNatRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + InboundNatRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.InboundNatRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + inbound_nat_rule_parameters=inbound_nat_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -328,12 +389,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('InboundNatRule', response) - if response.status_code == 201: - deserialized = self._deserialize('InboundNatRule', response) + deserialized = self._deserialize('InboundNatRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -341,10 +397,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_backend_address_pools_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_backend_address_pools_operations.py index 89420eea78d5..194c7c7d5a90 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_backend_address_pools_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_backend_address_pools_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -154,7 +154,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_frontend_ip_configurations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_frontend_ip_configurations_operations.py index b0207d49ba98..de0137fd3832 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_frontend_ip_configurations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_frontend_ip_configurations_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -154,7 +154,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_load_balancing_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_load_balancing_rules_operations.py index 5f05e3ad3028..b5dc0f233c05 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_load_balancing_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_load_balancing_rules_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -153,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_network_interfaces_operations.py index 890c1224d15f..71358f7e8d39 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_network_interfaces_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_probes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_probes_operations.py index c0700b4ce6f1..bae47c48823c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_probes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancer_probes_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -153,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancers_operations.py index db5fbd386ca4..048d5da96044 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/load_balancers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param parameters: Parameters supplied to the create or update load - balancer operation. - :type parameters: ~azure.mgmt.network.v2017_08_01.models.LoadBalancer - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns LoadBalancer - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.LoadBalancer] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LoadBalancer') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LoadBalancer', response) + if response.status_code == 201: + deserialized = self._deserialize('LoadBalancer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load + balancer operation. + :type parameters: ~azure.mgmt.network.v2017_08_01.models.LoadBalancer + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns LoadBalancer + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.LoadBalancer] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LoadBalancer', response) - if response.status_code == 201: - deserialized = self._deserialize('LoadBalancer', response) + deserialized = self._deserialize('LoadBalancer', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -317,7 +367,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/local_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/local_network_gateways_operations.py index d100c2b87620..1c409b1d5977 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/local_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/local_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a local network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param parameters: Parameters supplied to the create or update local - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.LocalNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - LocalNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.LocalNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LocalNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocalNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('LocalNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a local network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.LocalNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + LocalNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.LocalNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LocalNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('LocalNetworkGateway', response) + deserialized = self._deserialize('LocalNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified local network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified local network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interface_ip_configurations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interface_ip_configurations_operations.py index 9d7ccf573f17..844017e6dcac 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interface_ip_configurations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interface_ip_configurations_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -155,7 +155,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interface_load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interface_load_balancers_operations.py index 3b1964604260..1bd058f42e1f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interface_load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interface_load_balancers_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interfaces_operations.py index 9082bb2f8671..36ff50f1851d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_interfaces_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -36,23 +37,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-08-01" # Construct URL @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,28 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param parameters: Parameters supplied to the create or update network - interface operation. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.NetworkInterface - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkInterface or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.NetworkInterface] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2017-08-01" # Construct URL @@ -232,19 +236,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkInterface') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkInterface', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkInterface', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network + interface operation. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.NetworkInterface + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkInterface or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.NetworkInterface] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkInterface', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkInterface', response) + deserialized = self._deserialize('NetworkInterface', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -324,7 +374,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -393,7 +443,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -412,24 +462,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def get_effective_route_table( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all route tables applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.EffectiveRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_effective_route_table_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-08-01" # Construct URL @@ -456,18 +491,66 @@ def get_effective_route_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_effective_route_table( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all route tables applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.EffectiveRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_effective_route_table_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -476,10 +559,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveRouteListResult', response) + deserialized = self._deserialize('EffectiveRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -487,10 +567,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -498,25 +574,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_effective_network_security_groups( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all network security groups applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveNetworkSecurityGroupListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.EffectiveNetworkSecurityGroupListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_effective_network_security_groups_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-08-01" # Construct URL @@ -543,18 +603,67 @@ def list_effective_network_security_groups( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveNetworkSecurityGroupListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_effective_network_security_groups( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all network security groups applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveNetworkSecurityGroupListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.EffectiveNetworkSecurityGroupListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_effective_network_security_groups_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -563,10 +672,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) + deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -574,10 +680,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -643,7 +745,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -716,7 +818,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -791,7 +893,7 @@ def get_virtual_machine_scale_set_network_interface( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_security_groups_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_security_groups_operations.py index 5b1481ba5060..573944b5ca0b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_security_groups_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_security_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,24 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -80,18 +66,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def delete( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -104,10 +131,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network security group in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param parameters: Parameters supplied to the create or update network - security group operation. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.NetworkSecurityGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.NetworkSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -232,19 +234,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkSecurityGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network security group in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network + security group operation. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.NetworkSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.NetworkSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkSecurityGroup', response) + deserialized = self._deserialize('NetworkSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -322,7 +372,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -389,7 +439,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_watchers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_watchers_operations.py index a5f706603f5e..3521b9e64e37 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_watchers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/network_watchers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -152,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -170,23 +171,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network watcher resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}' path_format_arguments = { @@ -211,18 +198,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network watcher resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -235,10 +262,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -294,7 +317,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -358,7 +381,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -429,7 +452,7 @@ def get_topology( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -447,28 +470,9 @@ def get_topology( return deserialized - def verify_ip_flow( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Verify IP flow from the specified VM to a location given the currently - configured NSG rules. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the IP flow to be verified. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.VerificationIPFlowParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VerificationIPFlowResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VerificationIPFlowResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _verify_ip_flow_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify' path_format_arguments = { @@ -496,19 +500,74 @@ def verify_ip_flow( body_content = self._serialize.body(parameters, 'VerificationIPFlowParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('VerificationIPFlowResult', response) + if response.status_code == 202: + deserialized = self._deserialize('VerificationIPFlowResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def verify_ip_flow( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Verify IP flow from the specified VM to a location given the currently + configured NSG rules. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.VerificationIPFlowParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VerificationIPFlowResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VerificationIPFlowResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._verify_ip_flow_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -517,12 +576,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VerificationIPFlowResult', response) - if response.status_code == 202: - deserialized = self._deserialize('VerificationIPFlowResult', response) + deserialized = self._deserialize('VerificationIPFlowResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -530,10 +584,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -541,28 +591,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_next_hop( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Gets the next hop from the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the source and destination - endpoint. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.NextHopParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NextHopResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.NextHopResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_next_hop_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop' path_format_arguments = { @@ -590,19 +621,74 @@ def get_next_hop( body_content = self._serialize.body(parameters, 'NextHopParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('NextHopResult', response) + if response.status_code == 202: + deserialized = self._deserialize('NextHopResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_next_hop( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination + endpoint. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.NextHopParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NextHopResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.NextHopResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_next_hop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -611,12 +697,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NextHopResult', response) - if response.status_code == 202: - deserialized = self._deserialize('NextHopResult', response) + deserialized = self._deserialize('NextHopResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -624,10 +705,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -635,27 +712,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_vm_security_rules( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Gets the configured and effective security group rules on the specified - VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param target_resource_id: ID of the target VM. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - SecurityGroupViewResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.SecurityGroupViewResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_vm_security_rules_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.SecurityGroupViewParameters(target_resource_id=target_resource_id) # Construct URL @@ -685,19 +744,73 @@ def get_vm_security_rules( body_content = self._serialize.body(parameters, 'SecurityGroupViewParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('SecurityGroupViewResult', response) + if response.status_code == 202: + deserialized = self._deserialize('SecurityGroupViewResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_vm_security_rules( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the configured and effective security group rules on the specified + VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param target_resource_id: ID of the target VM. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + SecurityGroupViewResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.SecurityGroupViewResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_vm_security_rules_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -706,12 +819,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityGroupViewResult', response) - if response.status_code == 202: - deserialized = self._deserialize('SecurityGroupViewResult', response) + deserialized = self._deserialize('SecurityGroupViewResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -719,10 +827,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -730,28 +834,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Initiate troubleshooting on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the resource to - troubleshoot. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.TroubleshootingParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot' path_format_arguments = { @@ -779,19 +864,74 @@ def get_troubleshooting( body_content = self._serialize.body(parameters, 'TroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to + troubleshoot. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.TroubleshootingParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -800,12 +940,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -813,10 +948,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -824,27 +955,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting_result( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Get the last completed troubleshooting result on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource ID to query the - troubleshooting result. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_result_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.QueryTroubleshootingParameters(target_resource_id=target_resource_id) # Construct URL @@ -874,19 +987,73 @@ def get_troubleshooting_result( body_content = self._serialize.body(parameters, 'QueryTroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting_result( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource ID to query the + troubleshooting result. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_result_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -895,12 +1062,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -908,10 +1070,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -919,29 +1077,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_flow_log_configuration( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Configures flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the configuration of flow - log. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.FlowLogInformation - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_flow_log_configuration_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog' path_format_arguments = { @@ -969,19 +1107,75 @@ def set_flow_log_configuration( body_content = self._serialize.body(parameters, 'FlowLogInformation') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_flow_log_configuration( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Configures flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow + log. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.FlowLogInformation + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_flow_log_configuration_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -990,12 +1184,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1003,10 +1192,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1014,28 +1199,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_flow_log_status( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Queries status of flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource where getting the flow - logging status. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_flow_log_status_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.FlowLogStatusParameters(target_resource_id=target_resource_id) # Construct URL @@ -1065,19 +1231,74 @@ def get_flow_log_status( body_content = self._serialize.body(parameters, 'FlowLogStatusParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_flow_log_status( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Queries status of flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource where getting the flow + logging status. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_flow_log_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1086,12 +1307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1099,10 +1315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1110,33 +1322,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def check_connectivity( - self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): - """Verifies the possibility of establishing a direct TCP connection from a - virtual machine to a given endpoint including another VM or an - arbitrary remote server. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param source: - :type source: - ~azure.mgmt.network.v2017_08_01.models.ConnectivitySource - :param destination: - :type destination: - ~azure.mgmt.network.v2017_08_01.models.ConnectivityDestination - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectivityInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ConnectivityInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _check_connectivity_initial( + self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectivityParameters(source=source, destination=destination) # Construct URL @@ -1166,19 +1354,80 @@ def check_connectivity( body_content = self._serialize.body(parameters, 'ConnectivityParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectivityInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('ConnectivityInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def check_connectivity( + self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): + """Verifies the possibility of establishing a direct TCP connection from a + virtual machine to a given endpoint including another VM or an + arbitrary remote server. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param source: + :type source: + ~azure.mgmt.network.v2017_08_01.models.ConnectivitySource + :param destination: + :type destination: + ~azure.mgmt.network.v2017_08_01.models.ConnectivityDestination + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectivityInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ConnectivityInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._check_connectivity_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + source=source, + destination=destination, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1187,12 +1436,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectivityInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('ConnectivityInformation', response) + deserialized = self._deserialize('ConnectivityInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1200,10 +1444,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/packet_captures_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/packet_captures_operations.py index a08ca6f89d54..6f20b44ac4a1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/packet_captures_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/packet_captures_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,29 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create( - self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create and start a packet capture on the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param parameters: Parameters that define the create packet capture - operation. - :type parameters: ~azure.mgmt.network.v2017_08_01.models.PacketCapture - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.PacketCaptureResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -89,19 +70,74 @@ def create( body_content = self._serialize.body(parameters, 'PacketCapture') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('PacketCaptureResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture + operation. + :type parameters: ~azure.mgmt.network.v2017_08_01.models.PacketCapture + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.PacketCaptureResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,10 +146,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('PacketCaptureResult', response) + deserialized = self._deserialize('PacketCaptureResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -121,10 +154,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +207,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,25 +225,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -240,18 +253,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -264,10 +320,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -275,25 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Stops a specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop' path_format_arguments = { @@ -319,18 +355,61 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 stop( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Stops a specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +422,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -354,27 +429,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_status( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Query the status of a running packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the Network Watcher resource. - :type network_watcher_name: str - :param packet_capture_name: The name given to the packet capture - session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureQueryStatusResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.PacketCaptureQueryStatusResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_status_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus' path_format_arguments = { @@ -400,18 +457,72 @@ def get_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('PacketCaptureQueryStatusResult', response) + if response.status_code == 202: + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_status( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Query the status of a running packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param packet_capture_name: The name given to the packet capture + session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureQueryStatusResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.PacketCaptureQueryStatusResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -420,12 +531,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) - if response.status_code == 202: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -433,10 +539,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -495,7 +597,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/public_ip_addresses_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/public_ip_addresses_operations.py index cc2a736824e5..f31c39b73f63 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/public_ip_addresses_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/public_ip_addresses_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -36,23 +37,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the subnet. - :type public_ip_address_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-08-01" # Construct URL @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the subnet. + :type public_ip_address_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,28 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a static or dynamic public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the public IP address. - :type public_ip_address_name: str - :param parameters: Parameters supplied to the create or update public - IP address operation. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.PublicIPAddress - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PublicIPAddress or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.PublicIPAddress] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2017-08-01" # Construct URL @@ -232,19 +236,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'PublicIPAddress') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PublicIPAddress', response) + if response.status_code == 201: + deserialized = self._deserialize('PublicIPAddress', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public + IP address operation. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.PublicIPAddress + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PublicIPAddress or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.PublicIPAddress] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PublicIPAddress', response) - if response.status_code == 201: - deserialized = self._deserialize('PublicIPAddress', response) + deserialized = self._deserialize('PublicIPAddress', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -324,7 +374,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -393,7 +443,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -467,7 +517,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -550,7 +600,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -631,7 +681,7 @@ def get_virtual_machine_scale_set_public_ip_address( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_filter_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_filter_rules_operations.py index 5fe90d59640d..cdf4b6a89aa8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_filter_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_filter_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified rule from a route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the rule. - :type rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified rule from a route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the create - or update route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2017_08_01.models.RouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -233,19 +236,77 @@ def create_or_update( body_content = self._serialize.body(route_filter_rule_parameters, 'RouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create + or update route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2017_08_01.models.RouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -254,12 +315,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -267,10 +323,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -278,30 +330,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the update - route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2017_08_01.models.PatchRouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -330,19 +361,75 @@ def update( body_content = self._serialize.body(route_filter_rule_parameters, 'PatchRouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the update + route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2017_08_01.models.PatchRouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -351,10 +438,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -362,10 +446,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -424,7 +504,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_filters_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_filters_operations.py index 2067eb0a755f..a8f94b9237bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_filters_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_filters_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the create or - update route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2017_08_01.models.RouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(route_filter_parameters, 'RouteFilter') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or + update route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2017_08_01.models.RouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,28 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the update - route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2017_08_01.models.PatchRouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -322,19 +353,72 @@ def update( body_content = self._serialize.body(route_filter_parameters, 'PatchRouteFilter') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the update + route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2017_08_01.models.PatchRouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +427,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -354,10 +435,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -413,7 +490,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -477,7 +554,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_tables_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_tables_operations.py index ef4d75538022..aec475508870 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_tables_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/route_tables_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create or updates a route table in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param parameters: Parameters supplied to the create or update route - table operation. - :type parameters: ~azure.mgmt.network.v2017_08_01.models.RouteTable - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteTable - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.RouteTable] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'RouteTable') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteTable', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route + table operation. + :type parameters: ~azure.mgmt.network.v2017_08_01.models.RouteTable + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteTable + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.RouteTable] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteTable', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteTable', response) + deserialized = self._deserialize('RouteTable', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -320,7 +370,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -384,7 +434,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/routes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/routes_operations.py index 90b3220ac083..9a85accff103 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/routes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/routes_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route from a route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route from a route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,29 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param route_parameters: Parameters supplied to the create or update - route operation. - :type route_parameters: ~azure.mgmt.network.v2017_08_01.models.Route - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Route or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.Route] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -232,19 +236,76 @@ def create_or_update( body_content = self._serialize.body(route_parameters, 'Route') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Route', response) + if response.status_code == 201: + deserialized = self._deserialize('Route', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update + route operation. + :type route_parameters: ~azure.mgmt.network.v2017_08_01.models.Route + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Route or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.Route] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + route_parameters=route_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +314,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Route', response) - if response.status_code == 201: - deserialized = self._deserialize('Route', response) + deserialized = self._deserialize('Route', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +322,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -328,7 +380,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/security_rules_operations.py index 8f0b8e31890f..1b7022526ad9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/security_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,32 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a security rule in the specified network security - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param security_rule_parameters: Parameters supplied to the create or - update network security rule operation. - :type security_rule_parameters: - ~azure.mgmt.network.v2017_08_01.models.SecurityRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns SecurityRule - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.SecurityRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -237,19 +238,79 @@ def create_or_update( body_content = self._serialize.body(security_rule_parameters, 'SecurityRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SecurityRule', response) + if response.status_code == 201: + deserialized = self._deserialize('SecurityRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a security rule in the specified network security + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or + update network security rule operation. + :type security_rule_parameters: + ~azure.mgmt.network.v2017_08_01.models.SecurityRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns SecurityRule + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.SecurityRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + security_rule_parameters=security_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -258,12 +319,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityRule', response) - if response.status_code == 201: - deserialized = self._deserialize('SecurityRule', response) + deserialized = self._deserialize('SecurityRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -271,10 +327,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/subnets_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/subnets_operations.py index e5cfc5809a09..46a3b3ae7672 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/subnets_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/subnets_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified subnet. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified subnet. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,29 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a subnet in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param subnet_parameters: Parameters supplied to the create or update - subnet operation. - :type subnet_parameters: ~azure.mgmt.network.v2017_08_01.models.Subnet - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Subnet or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.Subnet] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -236,19 +240,76 @@ def create_or_update( body_content = self._serialize.body(subnet_parameters, 'Subnet') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Subnet', response) + if response.status_code == 201: + deserialized = self._deserialize('Subnet', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update + subnet operation. + :type subnet_parameters: ~azure.mgmt.network.v2017_08_01.models.Subnet + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Subnet or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.Subnet] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subnet_parameters=subnet_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -257,12 +318,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Subnet', response) - if response.status_code == 201: - deserialized = self._deserialize('Subnet', response) + deserialized = self._deserialize('Subnet', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -270,10 +326,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -332,7 +384,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/usages_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/usages_operations.py index 1e8ee19ba883..1d77588ff095 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/usages_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/usages_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_gateway_connections_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_gateway_connections_operations.py index b2df128a4709..df12a4fd1005 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_gateway_connections_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_gateway_connections_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway connection in the - specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param parameters: Parameters supplied to the create or update virtual - network gateway connection operation. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.VirtualNetworkGatewayConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGatewayConnection or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VirtualNetworkGatewayConnection] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGatewayConnection') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway connection in the + specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual + network gateway connection operation. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.VirtualNetworkGatewayConnection + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGatewayConnection or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VirtualNetworkGatewayConnection] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -181,7 +209,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -199,24 +227,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network Gateway connection. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -241,18 +254,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network Gateway connection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -265,10 +319,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -276,30 +326,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): - """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection name. - :type virtual_network_gateway_connection_name: str - :param value: The virtual network connection shared key value. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ConnectionSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionSharedKey(value=value) # Construct URL @@ -329,19 +358,76 @@ def set_shared_key( body_content = self._serialize.body(parameters, 'ConnectionSharedKey') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConnectionSharedKey', response) + if response.status_code == 201: + deserialized = self._deserialize('ConnectionSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection name. + :type virtual_network_gateway_connection_name: str + :param value: The virtual network connection shared key value. + :type value: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ConnectionSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + value=value, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -350,12 +436,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionSharedKey', response) - if response.status_code == 201: - deserialized = self._deserialize('ConnectionSharedKey', response) + deserialized = self._deserialize('ConnectionSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -363,10 +444,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -420,7 +497,7 @@ def get_shared_key( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -487,7 +564,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -506,31 +583,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): - """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection reset shared key Name. - :type virtual_network_gateway_connection_name: str - :param key_length: The virtual network connection reset shared key - length, should between 1 and 128. - :type key_length: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionResetSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ConnectionResetSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionResetSharedKey(key_length=key_length) # Construct URL @@ -560,19 +615,75 @@ def reset_shared_key( body_content = self._serialize.body(parameters, 'ConnectionResetSharedKey') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectionResetSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection reset shared key Name. + :type virtual_network_gateway_connection_name: str + :param key_length: The virtual network connection reset shared key + length, should between 1 and 128. + :type key_length: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionResetSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.ConnectionResetSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + key_length=key_length, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -581,10 +692,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionResetSharedKey', response) + deserialized = self._deserialize('ConnectionResetSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -592,10 +700,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_gateways_operations.py index a2bd9edade72..02583659b426 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to create or update virtual - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.VirtualNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.VirtualNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -321,7 +371,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -393,7 +443,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -412,29 +462,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset( - self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): - """Resets the primary of the virtual network gateway in the specified - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param gateway_vip: Virtual network gateway vip address supplied to - the begin reset of the active-active feature enabled gateway. - :type gateway_vip: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_initial( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset' path_format_arguments = { @@ -461,18 +491,72 @@ def reset( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): + """Resets the primary of the virtual network gateway in the specified + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param gateway_vip: Virtual network gateway vip address supplied to + the begin reset of the active-active feature enabled gateway. + :type gateway_vip: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + gateway_vip=gateway_vip, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -481,10 +565,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -492,10 +573,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -503,29 +580,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def generatevpnclientpackage( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Generates VPN client package for P2S client of the virtual network - gateway in the specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to the generate virtual network - gateway VPN client package operation. - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.VpnClientParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns str or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _generatevpnclientpackage_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage' path_format_arguments = { @@ -553,54 +610,30 @@ def generatevpnclientpackage( body_content = self._serialize.body(parameters, 'VpnClientParameters') # Construct and send request - def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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 + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - deserialized = None + deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('str', response) + if response.status_code == 200: + deserialized = self._deserialize('str', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - return deserialized + return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - - def generate_vpn_profile( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Generates VPN profile for P2S client of the virtual network gateway in - the specified resource group. Used for IKEV2 and radius based - authentication. + def generatevpnclientpackage( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Generates VPN client package for P2S client of the virtual network + gateway in the specified resource group. :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -620,6 +653,56 @@ def generate_vpn_profile( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + raw_result = self._generatevpnclientpackage_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = self._deserialize('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + + def _generate_vpn_profile_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile' path_format_arguments = { @@ -647,19 +730,74 @@ def generate_vpn_profile( body_content = self._serialize.body(parameters, 'VpnClientParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def generate_vpn_profile( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Generates VPN profile for P2S client of the virtual network gateway in + the specified resource group. Used for IKEV2 and radius based + authentication. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network + gateway VPN client package operation. + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.VpnClientParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns str or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._generate_vpn_profile_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -668,10 +806,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -679,10 +814,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -690,26 +821,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_vpn_profile_package_url( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Gets pre-generated VPN profile for P2S client of the virtual network - gateway in the specified resource group. The profile needs to be - generated first using generateVpnProfile. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns str or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_vpn_profile_package_url_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl' path_format_arguments = { @@ -734,18 +848,68 @@ def get_vpn_profile_package_url( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_vpn_profile_package_url( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Gets pre-generated VPN profile for P2S client of the virtual network + gateway in the specified resource group. The profile needs to be + generated first using generateVpnProfile. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns str or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_vpn_profile_package_url_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -754,10 +918,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -765,10 +926,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -776,27 +933,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_bgp_peer_status( - self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): - """The GetBgpPeerStatus operation retrieves the status of all BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer to retrieve the status of. - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - BgpPeerStatusListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.BgpPeerStatusListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_bgp_peer_status_initial( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus' path_format_arguments = { @@ -823,18 +962,70 @@ def get_bgp_peer_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code == 200: + deserialized = self._deserialize('BgpPeerStatusListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_bgp_peer_status( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): + """The GetBgpPeerStatus operation retrieves the status of all BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer to retrieve the status of. + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + BgpPeerStatusListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.BgpPeerStatusListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_bgp_peer_status_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -843,10 +1034,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BgpPeerStatusListResult', response) + deserialized = self._deserialize('BgpPeerStatusListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -854,10 +1042,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -865,26 +1049,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_learned_routes( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - has learned, including routes learned from BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_learned_routes_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes' path_format_arguments = { @@ -909,18 +1076,68 @@ def get_learned_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + return deserialized + + def get_learned_routes( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + has learned, including routes learned from BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_learned_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -929,10 +1146,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -940,10 +1154,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -951,28 +1161,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_advertised_routes( - self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - is advertising to the specified peer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_advertised_routes_initial( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes' path_format_arguments = { @@ -998,18 +1189,71 @@ def get_advertised_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_advertised_routes( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + is advertising to the specified peer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_advertised_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1018,10 +1262,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1029,10 +1270,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_peerings_operations.py index bde6edc24d8a..11a699bf9ea8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_network_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network peering. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the virtual network - peering. - :type virtual_network_peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network + peering. + :type virtual_network_peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the peering. - :type virtual_network_peering_name: str - :param virtual_network_peering_parameters: Parameters supplied to the - create or update virtual network peering operation. - :type virtual_network_peering_parameters: - ~azure.mgmt.network.v2017_08_01.models.VirtualNetworkPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VirtualNetworkPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(virtual_network_peering_parameters, 'VirtualNetworkPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the + create or update virtual network peering operation. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2017_08_01.models.VirtualNetworkPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VirtualNetworkPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + virtual_network_peering_parameters=virtual_network_peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkPeering', response) + deserialized = self._deserialize('VirtualNetworkPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_networks_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_networks_operations.py index 95c9ac2daf8e..6eda49acff8d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_networks_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_08_01/operations/virtual_networks_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network in the specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to the create or update virtual - network operation - :type parameters: - ~azure.mgmt.network.v2017_08_01.models.VirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetwork or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VirtualNetwork] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetwork') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetwork', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual + network operation + :type parameters: + ~azure.mgmt.network.v2017_08_01.models.VirtualNetwork + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetwork or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_08_01.models.VirtualNetwork] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetwork', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetwork', response) + deserialized = self._deserialize('VirtualNetwork', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -452,7 +502,7 @@ def check_ip_address_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -521,7 +571,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/address_space.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/address_space.py index 4ff6fb3af6d8..d7050c78a457 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/address_space.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/address_space.py @@ -26,4 +26,5 @@ class AddressSpace(Model): } def __init__(self, address_prefixes=None): + super(AddressSpace, self).__init__() self.address_prefixes = address_prefixes diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_available_waf_rule_sets_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_available_waf_rule_sets_result.py index 598fd56f2793..06a59afb03d9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_available_waf_rule_sets_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_available_waf_rule_sets_result.py @@ -25,4 +25,5 @@ class ApplicationGatewayAvailableWafRuleSetsResult(Model): } def __init__(self, value=None): + super(ApplicationGatewayAvailableWafRuleSetsResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_address.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_address.py index 5ff5ce4b4a5c..6005027d0845 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_address.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_address.py @@ -27,5 +27,6 @@ class ApplicationGatewayBackendAddress(Model): } def __init__(self, fqdn=None, ip_address=None): + super(ApplicationGatewayBackendAddress, self).__init__() self.fqdn = fqdn self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health.py index 5090aa3ff3ad..4a08c2278fa7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health.py @@ -25,4 +25,5 @@ class ApplicationGatewayBackendHealth(Model): } def __init__(self, backend_address_pools=None): + super(ApplicationGatewayBackendHealth, self).__init__() self.backend_address_pools = backend_address_pools diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_http_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_http_settings.py index 8ba975ba65d6..7af768cecf1f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_http_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_http_settings.py @@ -30,5 +30,6 @@ class ApplicationGatewayBackendHealthHttpSettings(Model): } def __init__(self, backend_http_settings=None, servers=None): + super(ApplicationGatewayBackendHealthHttpSettings, self).__init__() self.backend_http_settings = backend_http_settings self.servers = servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_pool.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_pool.py index bb877392f151..a1fc3ad643cd 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_pool.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_pool.py @@ -31,5 +31,6 @@ class ApplicationGatewayBackendHealthPool(Model): } def __init__(self, backend_address_pool=None, backend_http_settings_collection=None): + super(ApplicationGatewayBackendHealthPool, self).__init__() self.backend_address_pool = backend_address_pool self.backend_http_settings_collection = backend_http_settings_collection diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_server.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_server.py index 773c64ed3f69..1ad5b654c6b2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_server.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_backend_health_server.py @@ -33,6 +33,7 @@ class ApplicationGatewayBackendHealthServer(Model): } def __init__(self, address=None, ip_configuration=None, health=None): + super(ApplicationGatewayBackendHealthServer, self).__init__() self.address = address self.ip_configuration = ip_configuration self.health = health diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_connection_draining.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_connection_draining.py index e1912ca67c62..8f9b88b571e2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_connection_draining.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_connection_draining.py @@ -35,5 +35,6 @@ class ApplicationGatewayConnectionDraining(Model): } def __init__(self, enabled, drain_timeout_in_sec): + super(ApplicationGatewayConnectionDraining, self).__init__() self.enabled = enabled self.drain_timeout_in_sec = drain_timeout_in_sec diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_disabled_rule_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_disabled_rule_group.py index cac1f2bd38e0..02c88980e857 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_disabled_rule_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_disabled_rule_group.py @@ -32,5 +32,6 @@ class ApplicationGatewayFirewallDisabledRuleGroup(Model): } def __init__(self, rule_group_name, rules=None): + super(ApplicationGatewayFirewallDisabledRuleGroup, self).__init__() self.rule_group_name = rule_group_name self.rules = rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_rule.py index 74db98eb4e23..f3f7da7cc11b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_rule.py @@ -31,5 +31,6 @@ class ApplicationGatewayFirewallRule(Model): } def __init__(self, rule_id, description=None): + super(ApplicationGatewayFirewallRule, self).__init__() self.rule_id = rule_id self.description = description diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_rule_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_rule_group.py index 8fba8baa4ea9..e9ff97e069ea 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_rule_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_firewall_rule_group.py @@ -38,6 +38,7 @@ class ApplicationGatewayFirewallRuleGroup(Model): } def __init__(self, rule_group_name, rules, description=None): + super(ApplicationGatewayFirewallRuleGroup, self).__init__() self.rule_group_name = rule_group_name self.description = description self.rules = rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_probe_health_response_match.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_probe_health_response_match.py index 4c8ddb2c0896..beaef556eb99 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_probe_health_response_match.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_probe_health_response_match.py @@ -29,5 +29,6 @@ class ApplicationGatewayProbeHealthResponseMatch(Model): } def __init__(self, body=None, status_codes=None): + super(ApplicationGatewayProbeHealthResponseMatch, self).__init__() self.body = body self.status_codes = status_codes diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_sku.py index 5c7aa9cdc515..c3e40e10155c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_sku.py @@ -35,6 +35,7 @@ class ApplicationGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(ApplicationGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_ssl_policy.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_ssl_policy.py index 11ef75d05607..d823a25c4b8b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_ssl_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_ssl_policy.py @@ -48,6 +48,7 @@ class ApplicationGatewaySslPolicy(Model): } def __init__(self, disabled_ssl_protocols=None, policy_type=None, policy_name=None, cipher_suites=None, min_protocol_version=None): + super(ApplicationGatewaySslPolicy, self).__init__() self.disabled_ssl_protocols = disabled_ssl_protocols self.policy_type = policy_type self.policy_name = policy_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_web_application_firewall_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_web_application_firewall_configuration.py index 1fd488bd6485..fb125a903d76 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_web_application_firewall_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_web_application_firewall_configuration.py @@ -47,6 +47,7 @@ class ApplicationGatewayWebApplicationFirewallConfiguration(Model): } def __init__(self, enabled, firewall_mode, rule_set_type, rule_set_version, disabled_rule_groups=None): + super(ApplicationGatewayWebApplicationFirewallConfiguration, self).__init__() self.enabled = enabled self.firewall_mode = firewall_mode self.rule_set_type = rule_set_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/availability.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/availability.py index c190d9e1ec7b..c45356ed4847 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/availability.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/availability.py @@ -30,6 +30,7 @@ class Availability(Model): } def __init__(self, time_grain=None, retention=None, blob_duration=None): + super(Availability, self).__init__() self.time_grain = time_grain self.retention = retention self.blob_duration = blob_duration diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list.py index 60451e745a79..4b616286885e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list.py @@ -29,4 +29,5 @@ class AvailableProvidersList(Model): } def __init__(self, countries): + super(AvailableProvidersList, self).__init__() self.countries = countries diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_city.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_city.py index 55b2f6a1b6df..cfd9fa55e297 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_city.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_city.py @@ -27,5 +27,6 @@ class AvailableProvidersListCity(Model): } def __init__(self, city_name=None, providers=None): + super(AvailableProvidersListCity, self).__init__() self.city_name = city_name self.providers = providers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_country.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_country.py index 57de5e985f03..f5652ff427a9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_country.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_country.py @@ -31,6 +31,7 @@ class AvailableProvidersListCountry(Model): } def __init__(self, country_name=None, providers=None, states=None): + super(AvailableProvidersListCountry, self).__init__() self.country_name = country_name self.providers = providers self.states = states diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_parameters.py index 6f367baa2921..4eb335e056b6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_parameters.py @@ -34,6 +34,7 @@ class AvailableProvidersListParameters(Model): } def __init__(self, azure_locations=None, country=None, state=None, city=None): + super(AvailableProvidersListParameters, self).__init__() self.azure_locations = azure_locations self.country = country self.state = state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_state.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_state.py index 2c2efdfa1af9..f956b545b19b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_state.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list_state.py @@ -31,6 +31,7 @@ class AvailableProvidersListState(Model): } def __init__(self, state_name=None, providers=None, cities=None): + super(AvailableProvidersListState, self).__init__() self.state_name = state_name self.providers = providers self.cities = cities diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_async_operation_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_async_operation_result.py index 9f42c76bbd59..77ed5c1aef8a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_async_operation_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_async_operation_result.py @@ -37,5 +37,6 @@ class AzureAsyncOperationResult(Model): } def __init__(self, status=None, error=None): + super(AzureAsyncOperationResult, self).__init__() self.status = status self.error = error diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report.py index 150604687051..20e5fce5f1b4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report.py @@ -39,6 +39,7 @@ class AzureReachabilityReport(Model): } def __init__(self, aggregation_level, provider_location, reachability_report): + super(AzureReachabilityReport, self).__init__() self.aggregation_level = aggregation_level self.provider_location = provider_location self.reachability_report = reachability_report diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_item.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_item.py index 2c399dac4402..c87d4b22cd3b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_item.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_item.py @@ -31,6 +31,7 @@ class AzureReachabilityReportItem(Model): } def __init__(self, provider=None, azure_location=None, latencies=None): + super(AzureReachabilityReportItem, self).__init__() self.provider = provider self.azure_location = azure_location self.latencies = latencies diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_latency_info.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_latency_info.py index 4fb59f2a7a28..c4920ffb64be 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_latency_info.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_latency_info.py @@ -32,5 +32,6 @@ class AzureReachabilityReportLatencyInfo(Model): } def __init__(self, time_stamp=None, score=None): + super(AzureReachabilityReportLatencyInfo, self).__init__() self.time_stamp = time_stamp self.score = score diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_location.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_location.py index cf9d5475ae4d..0da63a04e016 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_location.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_location.py @@ -34,6 +34,7 @@ class AzureReachabilityReportLocation(Model): } def __init__(self, country, state=None, city=None): + super(AzureReachabilityReportLocation, self).__init__() self.country = country self.state = state self.city = city diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_parameters.py index bba98d608993..fe254690b246 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/azure_reachability_report_parameters.py @@ -43,6 +43,7 @@ class AzureReachabilityReportParameters(Model): } def __init__(self, provider_location, start_time, end_time, providers=None, azure_locations=None): + super(AzureReachabilityReportParameters, self).__init__() self.provider_location = provider_location self.providers = providers self.azure_locations = azure_locations diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_community.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_community.py index b80621009023..8275a0e4048c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_community.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_community.py @@ -43,6 +43,7 @@ class BGPCommunity(Model): } def __init__(self, service_supported_region=None, community_name=None, community_value=None, community_prefixes=None, is_authorized_to_use=None, service_group=None): + super(BGPCommunity, self).__init__() self.service_supported_region = service_supported_region self.community_name = community_name self.community_value = community_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_peer_status.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_peer_status.py index 0b8cdba7b0e3..187036110092 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_peer_status.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_peer_status.py @@ -60,6 +60,7 @@ class BgpPeerStatus(Model): } def __init__(self): + super(BgpPeerStatus, self).__init__() self.local_address = None self.neighbor = None self.asn = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_peer_status_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_peer_status_list_result.py index 3afe3c95a2cb..0eb7e3a6137c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_peer_status_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_peer_status_list_result.py @@ -24,4 +24,5 @@ class BgpPeerStatusListResult(Model): } def __init__(self, value=None): + super(BgpPeerStatusListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_settings.py index d62cc30ab0c7..c5730da2e43e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/bgp_settings.py @@ -32,6 +32,7 @@ class BgpSettings(Model): } def __init__(self, asn=None, bgp_peering_address=None, peer_weight=None): + super(BgpSettings, self).__init__() self.asn = asn self.bgp_peering_address = bgp_peering_address self.peer_weight = peer_weight diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connection_reset_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connection_reset_shared_key.py index 10bfdc9ba17d..3338112a7fe7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connection_reset_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connection_reset_shared_key.py @@ -29,4 +29,5 @@ class ConnectionResetSharedKey(Model): } def __init__(self, key_length): + super(ConnectionResetSharedKey, self).__init__() self.key_length = key_length diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connection_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connection_shared_key.py index 0dbbc36cc798..2c1b0ed9a914 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connection_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connection_shared_key.py @@ -28,4 +28,5 @@ class ConnectionSharedKey(Model): } def __init__(self, value): + super(ConnectionSharedKey, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_destination.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_destination.py index 756dfadfdd49..cd0e8818b591 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_destination.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_destination.py @@ -32,6 +32,7 @@ class ConnectivityDestination(Model): } def __init__(self, resource_id=None, address=None, port=None): + super(ConnectivityDestination, self).__init__() self.resource_id = resource_id self.address = address self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_hop.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_hop.py index 896d606608da..b0e9873cf1b8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_hop.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_hop.py @@ -52,6 +52,7 @@ class ConnectivityHop(Model): } def __init__(self): + super(ConnectivityHop, self).__init__() self.type = None self.id = None self.address = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_information.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_information.py index 899078f39283..5a17ac8364cc 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_information.py @@ -58,6 +58,7 @@ class ConnectivityInformation(Model): } def __init__(self): + super(ConnectivityInformation, self).__init__() self.hops = None self.connection_status = None self.avg_latency_in_ms = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_issue.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_issue.py index 0e90444fca9d..75337cdc7472 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_issue.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_issue.py @@ -48,6 +48,7 @@ class ConnectivityIssue(Model): } def __init__(self): + super(ConnectivityIssue, self).__init__() self.origin = None self.severity = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_parameters.py index 7205a94109be..12c552a2a53c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_parameters.py @@ -33,5 +33,6 @@ class ConnectivityParameters(Model): } def __init__(self, source, destination): + super(ConnectivityParameters, self).__init__() self.source = source self.destination = destination diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_source.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_source.py index 8c7034e63c32..c42bfc0aa09d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_source.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/connectivity_source.py @@ -33,5 +33,6 @@ class ConnectivitySource(Model): } def __init__(self, resource_id, port=None): + super(ConnectivitySource, self).__init__() self.resource_id = resource_id self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dhcp_options.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dhcp_options.py index 2262eb5ec2f1..8744ba6fc9b1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dhcp_options.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dhcp_options.py @@ -26,4 +26,5 @@ class DhcpOptions(Model): } def __init__(self, dns_servers=None): + super(DhcpOptions, self).__init__() self.dns_servers = dns_servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dimension.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dimension.py index 686a1e0570a6..f18204215221 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dimension.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dimension.py @@ -30,6 +30,7 @@ class Dimension(Model): } def __init__(self, name=None, display_name=None, internal_name=None): + super(Dimension, self).__init__() self.name = name self.display_name = display_name self.internal_name = internal_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dns_name_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dns_name_availability_result.py index 4be1851d2f59..15a0238e49a7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dns_name_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/dns_name_availability_result.py @@ -24,4 +24,5 @@ class DnsNameAvailabilityResult(Model): } def __init__(self, available=None): + super(DnsNameAvailabilityResult, self).__init__() self.available = available diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group.py index 7247bfa76f94..78481ed79d28 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group.py @@ -38,6 +38,7 @@ class EffectiveNetworkSecurityGroup(Model): } def __init__(self, network_security_group=None, association=None, effective_security_rules=None, tag_map=None): + super(EffectiveNetworkSecurityGroup, self).__init__() self.network_security_group = network_security_group self.association = association self.effective_security_rules = effective_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group_association.py index 8a276ef239d9..2cf439cbdb37 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group_association.py @@ -28,5 +28,6 @@ class EffectiveNetworkSecurityGroupAssociation(Model): } def __init__(self, subnet=None, network_interface=None): + super(EffectiveNetworkSecurityGroupAssociation, self).__init__() self.subnet = subnet self.network_interface = network_interface diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group_list_result.py index 3733c0aa276a..ec04622670cc 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_group_list_result.py @@ -35,5 +35,6 @@ class EffectiveNetworkSecurityGroupListResult(Model): } def __init__(self, value=None): + super(EffectiveNetworkSecurityGroupListResult, self).__init__() self.value = value self.next_link = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_rule.py index ebb0aeca45dd..cef084bc8b18 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_network_security_rule.py @@ -83,6 +83,7 @@ class EffectiveNetworkSecurityRule(Model): } def __init__(self, name=None, protocol=None, source_port_range=None, destination_port_range=None, source_port_ranges=None, destination_port_ranges=None, source_address_prefix=None, destination_address_prefix=None, source_address_prefixes=None, destination_address_prefixes=None, expanded_source_address_prefix=None, expanded_destination_address_prefix=None, access=None, priority=None, direction=None): + super(EffectiveNetworkSecurityRule, self).__init__() self.name = name self.protocol = protocol self.source_port_range = source_port_range diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_route.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_route.py index 9f8309ac29dc..c76f86173777 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_route.py @@ -51,6 +51,7 @@ class EffectiveRoute(Model): } def __init__(self, name=None, source=None, state=None, address_prefix=None, next_hop_ip_address=None, next_hop_type=None): + super(EffectiveRoute, self).__init__() self.name = name self.source = source self.state = state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_route_list_result.py index db398b08a34c..e5acb20d180d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/effective_route_list_result.py @@ -34,5 +34,6 @@ class EffectiveRouteListResult(Model): } def __init__(self, value=None): + super(EffectiveRouteListResult, self).__init__() self.value = value self.next_link = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/error.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/error.py index d51677cd14ee..7667a0ee38db 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/error.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/error.py @@ -36,6 +36,7 @@ class Error(Model): } def __init__(self, code=None, message=None, target=None, details=None, inner_error=None): + super(Error, self).__init__() self.code = code self.message = message self.target = target diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/error_details.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/error_details.py index 47f2ac4111b1..40bea00aa2fb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/error_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/error_details.py @@ -30,6 +30,7 @@ class ErrorDetails(Model): } def __init__(self, code=None, target=None, message=None): + super(ErrorDetails, self).__init__() self.code = code self.target = target self.message = message diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_arp_table.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_arp_table.py index a2f8f716bf8a..ace325747ee5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_arp_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_arp_table.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitArpTable(Model): } def __init__(self, age=None, interface=None, ip_address=None, mac_address=None): + super(ExpressRouteCircuitArpTable, self).__init__() self.age = age self.interface = interface self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_peering_config.py index 16ca0719bebb..ba5cbb597272 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_peering_config.py @@ -46,6 +46,7 @@ class ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, advertised_public_prefixes=None, advertised_communities=None, advertised_public_prefixes_state=None, legacy_mode=None, customer_asn=None, routing_registry_name=None): + super(ExpressRouteCircuitPeeringConfig, self).__init__() self.advertised_public_prefixes = advertised_public_prefixes self.advertised_communities = advertised_communities self.advertised_public_prefixes_state = advertised_public_prefixes_state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_routes_table.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_routes_table.py index e84fae6e0973..804d29a2f9bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_routes_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_routes_table.py @@ -36,6 +36,7 @@ class ExpressRouteCircuitRoutesTable(Model): } def __init__(self, network=None, next_hop=None, loc_prf=None, weight=None, path=None): + super(ExpressRouteCircuitRoutesTable, self).__init__() self.network = network self.next_hop = next_hop self.loc_prf = loc_prf diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_routes_table_summary.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_routes_table_summary.py index 3ff1b42d0c1b..6f5f89764dd4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_routes_table_summary.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_routes_table_summary.py @@ -38,6 +38,7 @@ class ExpressRouteCircuitRoutesTableSummary(Model): } def __init__(self, neighbor=None, v=None, as_property=None, up_down=None, state_pfx_rcd=None): + super(ExpressRouteCircuitRoutesTableSummary, self).__init__() self.neighbor = neighbor self.v = v self.as_property = as_property diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_service_provider_properties.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_service_provider_properties.py index b7ada851e235..7a6b4ba96061 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_service_provider_properties.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_service_provider_properties.py @@ -30,6 +30,7 @@ class ExpressRouteCircuitServiceProviderProperties(Model): } def __init__(self, service_provider_name=None, peering_location=None, bandwidth_in_mbps=None): + super(ExpressRouteCircuitServiceProviderProperties, self).__init__() self.service_provider_name = service_provider_name self.peering_location = peering_location self.bandwidth_in_mbps = bandwidth_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_sku.py index d15eb7229cf2..bb23ff0b326f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_sku.py @@ -34,6 +34,7 @@ class ExpressRouteCircuitSku(Model): } def __init__(self, name=None, tier=None, family=None): + super(ExpressRouteCircuitSku, self).__init__() self.name = name self.tier = tier self.family = family diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_stats.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_stats.py index 1215bda40383..e26f6f7d2f74 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_stats.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuit_stats.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitStats(Model): } def __init__(self, primarybytes_in=None, primarybytes_out=None, secondarybytes_in=None, secondarybytes_out=None): + super(ExpressRouteCircuitStats, self).__init__() self.primarybytes_in = primarybytes_in self.primarybytes_out = primarybytes_out self.secondarybytes_in = secondarybytes_in diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_arp_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_arp_table_list_result.py index d8f8d0f3bf90..0564ea379360 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_arp_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_arp_table_list_result.py @@ -28,5 +28,6 @@ class ExpressRouteCircuitsArpTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsArpTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_routes_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_routes_table_list_result.py index 2e8e65fe05fb..aedef95b8745 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_routes_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_routes_table_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_routes_table_summary_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_routes_table_summary_list_result.py index 2feb9f5c616d..ade34ebbff65 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_routes_table_summary_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_circuits_routes_table_summary_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableSummaryListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableSummaryListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_service_provider_bandwidths_offered.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_service_provider_bandwidths_offered.py index b1b2c8a76447..9cbba2fcfe97 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_service_provider_bandwidths_offered.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/express_route_service_provider_bandwidths_offered.py @@ -27,5 +27,6 @@ class ExpressRouteServiceProviderBandwidthsOffered(Model): } def __init__(self, offer_name=None, value_in_mbps=None): + super(ExpressRouteServiceProviderBandwidthsOffered, self).__init__() self.offer_name = offer_name self.value_in_mbps = value_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/flow_log_information.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/flow_log_information.py index ceab0ed4ddd2..640405eec9d5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/flow_log_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/flow_log_information.py @@ -42,6 +42,7 @@ class FlowLogInformation(Model): } def __init__(self, target_resource_id, storage_id, enabled, retention_policy=None): + super(FlowLogInformation, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/flow_log_status_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/flow_log_status_parameters.py index 1dae2ff24447..4cd22222bb45 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/flow_log_status_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/flow_log_status_parameters.py @@ -29,4 +29,5 @@ class FlowLogStatusParameters(Model): } def __init__(self, target_resource_id): + super(FlowLogStatusParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/gateway_route.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/gateway_route.py index d3e0d4163c35..64a53f146c0b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/gateway_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/gateway_route.py @@ -55,6 +55,7 @@ class GatewayRoute(Model): } def __init__(self): + super(GatewayRoute, self).__init__() self.local_address = None self.network = None self.next_hop = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/gateway_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/gateway_route_list_result.py index 8b51aace9756..ad588f75f0d9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/gateway_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/gateway_route_list_result.py @@ -24,4 +24,5 @@ class GatewayRouteListResult(Model): } def __init__(self, value=None): + super(GatewayRouteListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ip_address_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ip_address_availability_result.py index 0e26dd91fffc..f2cb36a550ec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ip_address_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ip_address_availability_result.py @@ -28,5 +28,6 @@ class IPAddressAvailabilityResult(Model): } def __init__(self, available=None, available_ip_addresses=None): + super(IPAddressAvailabilityResult, self).__init__() self.available = available self.available_ip_addresses = available_ip_addresses diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ipsec_policy.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ipsec_policy.py index b66b5545cad7..a86aa77a27d0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ipsec_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ipsec_policy.py @@ -74,6 +74,7 @@ class IpsecPolicy(Model): } def __init__(self, sa_life_time_seconds, sa_data_size_kilobytes, ipsec_encryption, ipsec_integrity, ike_encryption, ike_integrity, dh_group, pfs_group): + super(IpsecPolicy, self).__init__() self.sa_life_time_seconds = sa_life_time_seconds self.sa_data_size_kilobytes = sa_data_size_kilobytes self.ipsec_encryption = ipsec_encryption diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ipv6_express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ipv6_express_route_circuit_peering_config.py index d5c501a740ee..1fa5ead2f79b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ipv6_express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ipv6_express_route_circuit_peering_config.py @@ -39,6 +39,7 @@ class Ipv6ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, primary_peer_address_prefix=None, secondary_peer_address_prefix=None, microsoft_peering_config=None, route_filter=None, state=None): + super(Ipv6ExpressRouteCircuitPeeringConfig, self).__init__() self.primary_peer_address_prefix = primary_peer_address_prefix self.secondary_peer_address_prefix = secondary_peer_address_prefix self.microsoft_peering_config = microsoft_peering_config diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/load_balancer_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/load_balancer_sku.py index fc11e5d2423a..463fceebfda3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/load_balancer_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/load_balancer_sku.py @@ -26,4 +26,5 @@ class LoadBalancerSku(Model): } def __init__(self, name=None): + super(LoadBalancerSku, self).__init__() self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/log_specification.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/log_specification.py index cec1bbfcacb9..2386ea5f799f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/log_specification.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/log_specification.py @@ -30,6 +30,7 @@ class LogSpecification(Model): } def __init__(self, name=None, display_name=None, blob_duration=None): + super(LogSpecification, self).__init__() self.name = name self.display_name = display_name self.blob_duration = blob_duration diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/metric_specification.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/metric_specification.py index 9b6fb5cde016..12432a256747 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/metric_specification.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/metric_specification.py @@ -65,6 +65,7 @@ class MetricSpecification(Model): } def __init__(self, name=None, display_name=None, display_description=None, unit=None, aggregation_type=None, availabilities=None, enable_regional_mdm_account=None, fill_gap_with_zero=None, metric_filter_pattern=None, dimensions=None, is_internal=None, source_mdm_account=None, source_mdm_namespace=None, resource_id_dimension_name_override=None): + super(MetricSpecification, self).__init__() self.name = name self.display_name = display_name self.display_description = display_description diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_interface_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_interface_association.py index d7452ec0a726..391f93d931e1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_interface_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_interface_association.py @@ -35,5 +35,6 @@ class NetworkInterfaceAssociation(Model): } def __init__(self, security_rules=None): + super(NetworkInterfaceAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_interface_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_interface_dns_settings.py index 110594c2f928..675a4a1eb08a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_interface_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_interface_dns_settings.py @@ -47,6 +47,7 @@ class NetworkInterfaceDnsSettings(Model): } def __init__(self, dns_servers=None, applied_dns_servers=None, internal_dns_name_label=None, internal_fqdn=None, internal_domain_name_suffix=None): + super(NetworkInterfaceDnsSettings, self).__init__() self.dns_servers = dns_servers self.applied_dns_servers = applied_dns_servers self.internal_dns_name_label = internal_dns_name_label diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/next_hop_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/next_hop_parameters.py index f38a8ce62abb..3e1478409a0a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/next_hop_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/next_hop_parameters.py @@ -42,6 +42,7 @@ class NextHopParameters(Model): } def __init__(self, target_resource_id, source_ip_address, destination_ip_address, target_nic_resource_id=None): + super(NextHopParameters, self).__init__() self.target_resource_id = target_resource_id self.source_ip_address = source_ip_address self.destination_ip_address = destination_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/next_hop_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/next_hop_result.py index 47826e5cd34e..6ef065c8973e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/next_hop_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/next_hop_result.py @@ -36,6 +36,7 @@ class NextHopResult(Model): } def __init__(self, next_hop_type=None, next_hop_ip_address=None, route_table_id=None): + super(NextHopResult, self).__init__() self.next_hop_type = next_hop_type self.next_hop_ip_address = next_hop_ip_address self.route_table_id = route_table_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation.py index 3d14042f5c10..09f993e607ed 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation.py @@ -34,6 +34,7 @@ class Operation(Model): } def __init__(self, name=None, display=None, origin=None, service_specification=None): + super(Operation, self).__init__() self.name = name self.display = display self.origin = origin diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation_display.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation_display.py index 047521791265..91ea63defbf0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation_display.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation_display.py @@ -33,6 +33,7 @@ class OperationDisplay(Model): } def __init__(self, provider=None, resource=None, operation=None, description=None): + super(OperationDisplay, self).__init__() self.provider = provider self.resource = resource self.operation = operation diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation_properties_format_service_specification.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation_properties_format_service_specification.py index 66d37ce7b41a..0225ee10e035 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation_properties_format_service_specification.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/operation_properties_format_service_specification.py @@ -29,5 +29,6 @@ class OperationPropertiesFormatServiceSpecification(Model): } def __init__(self, metric_specifications=None, log_specifications=None): + super(OperationPropertiesFormatServiceSpecification, self).__init__() self.metric_specifications = metric_specifications self.log_specifications = log_specifications diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture.py index 6e05cdbff8bc..9c7b320f5ddf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture.py @@ -50,6 +50,7 @@ class PacketCapture(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCapture, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_filter.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_filter.py index afd80ed8fb98..719356ace77a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_filter.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_filter.py @@ -52,6 +52,7 @@ class PacketCaptureFilter(Model): } def __init__(self, protocol="Any", local_ip_address=None, remote_ip_address=None, local_port=None, remote_port=None): + super(PacketCaptureFilter, self).__init__() self.protocol = protocol self.local_ip_address = local_ip_address self.remote_ip_address = remote_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_parameters.py index 785a952dfde8..2baeb60a37b8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_parameters.py @@ -50,6 +50,7 @@ class PacketCaptureParameters(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCaptureParameters, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_query_status_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_query_status_result.py index 1719bcb98f80..f0155ab77fda 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_query_status_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_query_status_result.py @@ -44,6 +44,7 @@ class PacketCaptureQueryStatusResult(Model): } def __init__(self, name=None, id=None, capture_start_time=None, packet_capture_status=None, stop_reason=None, packet_capture_error=None): + super(PacketCaptureQueryStatusResult, self).__init__() self.name = name self.id = id self.capture_start_time = capture_start_time diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_result.py index cceccde7a15c..7e2621007157 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_result.py @@ -71,6 +71,7 @@ class PacketCaptureResult(Model): } def __init__(self, target, storage_location, etag="A unique read-only string that changes whenever the resource is updated.", bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None, provisioning_state=None): + super(PacketCaptureResult, self).__init__() self.name = None self.id = None self.etag = etag diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_storage_location.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_storage_location.py index d0987d11ff9f..773b04d22501 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_storage_location.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/packet_capture_storage_location.py @@ -36,6 +36,7 @@ class PacketCaptureStorageLocation(Model): } def __init__(self, storage_id=None, storage_path=None, file_path=None): + super(PacketCaptureStorageLocation, self).__init__() self.storage_id = storage_id self.storage_path = storage_path self.file_path = file_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/public_ip_address_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/public_ip_address_dns_settings.py index 65a534407848..a248461f05d7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/public_ip_address_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/public_ip_address_dns_settings.py @@ -39,6 +39,7 @@ class PublicIPAddressDnsSettings(Model): } def __init__(self, domain_name_label=None, fqdn=None, reverse_fqdn=None): + super(PublicIPAddressDnsSettings, self).__init__() self.domain_name_label = domain_name_label self.fqdn = fqdn self.reverse_fqdn = reverse_fqdn diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/public_ip_address_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/public_ip_address_sku.py index 469a63e62793..4a6d29697430 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/public_ip_address_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/public_ip_address_sku.py @@ -26,4 +26,5 @@ class PublicIPAddressSku(Model): } def __init__(self, name=None): + super(PublicIPAddressSku, self).__init__() self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/query_troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/query_troubleshooting_parameters.py index a394b181fcc5..9b6801eb7b63 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/query_troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/query_troubleshooting_parameters.py @@ -29,4 +29,5 @@ class QueryTroubleshootingParameters(Model): } def __init__(self, target_resource_id): + super(QueryTroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/resource.py index ef9699426827..ff5f1f40e14e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/resource.py @@ -44,6 +44,7 @@ class Resource(Model): } def __init__(self, id=None, location=None, tags=None): + super(Resource, self).__init__() self.id = id self.name = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/retention_policy_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/retention_policy_parameters.py index 58f7f12cc6a9..102f4c5c3b4c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/retention_policy_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/retention_policy_parameters.py @@ -27,5 +27,6 @@ class RetentionPolicyParameters(Model): } def __init__(self, days=0, enabled=False): + super(RetentionPolicyParameters, self).__init__() self.days = days self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_network_interface.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_network_interface.py index 683a776d3581..e4996c482954 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_network_interface.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_network_interface.py @@ -28,5 +28,6 @@ class SecurityGroupNetworkInterface(Model): } def __init__(self, id=None, security_rule_associations=None): + super(SecurityGroupNetworkInterface, self).__init__() self.id = id self.security_rule_associations = security_rule_associations diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_view_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_view_parameters.py index 304908dd4792..5c0972e5d55e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_view_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_view_parameters.py @@ -28,4 +28,5 @@ class SecurityGroupViewParameters(Model): } def __init__(self, target_resource_id): + super(SecurityGroupViewParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_view_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_view_result.py index 1efe0ecc7736..fc69f548464d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_view_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_group_view_result.py @@ -25,4 +25,5 @@ class SecurityGroupViewResult(Model): } def __init__(self, network_interfaces=None): + super(SecurityGroupViewResult, self).__init__() self.network_interfaces = network_interfaces diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_rule.py index 067d91121336..0ff278477a2f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_rule.py @@ -111,7 +111,7 @@ class SecurityRule(SubResource): 'etag': {'key': 'etag', 'type': 'str'}, } - def __init__(self, protocol, source_address_prefix=None, destination_address_prefix=None, access=None, direction=None, id=None, description=None, source_port_range=None, destination_port_range=None, source_address_prefixes=None, source_application_security_groups=None, destination_address_prefixes=None, destination_application_security_groups=None, source_port_ranges=None, destination_port_ranges=None, priority=None, provisioning_state=None, name=None, etag=None): + def __init__(self, protocol, access, direction, id=None, description=None, source_port_range=None, destination_port_range=None, source_address_prefix=None, source_address_prefixes=None, source_application_security_groups=None, destination_address_prefix=None, destination_address_prefixes=None, destination_application_security_groups=None, source_port_ranges=None, destination_port_ranges=None, priority=None, provisioning_state=None, name=None, etag=None): super(SecurityRule, self).__init__(id=id) self.description = description self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_rule_associations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_rule_associations.py index 252bf4cc81b2..8c120c665c49 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_rule_associations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/security_rule_associations.py @@ -38,6 +38,7 @@ class SecurityRuleAssociations(Model): } def __init__(self, network_interface_association=None, subnet_association=None, default_security_rules=None, effective_security_rules=None): + super(SecurityRuleAssociations, self).__init__() self.network_interface_association = network_interface_association self.subnet_association = subnet_association self.default_security_rules = default_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/service_endpoint_properties_format.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/service_endpoint_properties_format.py index 0168d03284a9..847cb9ac8b3b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/service_endpoint_properties_format.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/service_endpoint_properties_format.py @@ -30,6 +30,7 @@ class ServiceEndpointPropertiesFormat(Model): } def __init__(self, service=None, locations=None, provisioning_state=None): + super(ServiceEndpointPropertiesFormat, self).__init__() self.service = service self.locations = locations self.provisioning_state = provisioning_state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/sub_resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/sub_resource.py index b23dc42afd0e..491f1d1caf83 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/sub_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/sub_resource.py @@ -24,4 +24,5 @@ class SubResource(Model): } def __init__(self, id=None): + super(SubResource, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/subnet_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/subnet_association.py index d8faa50c0dcb..369570207014 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/subnet_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/subnet_association.py @@ -35,5 +35,6 @@ class SubnetAssociation(Model): } def __init__(self, security_rules=None): + super(SubnetAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/tags_object.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/tags_object.py index db3796de9bdc..539129368be9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/tags_object.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/tags_object.py @@ -24,4 +24,5 @@ class TagsObject(Model): } def __init__(self, tags=None): + super(TagsObject, self).__init__() self.tags = tags diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology.py index d538635fb98d..45c6886fe0df 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology.py @@ -44,6 +44,7 @@ class Topology(Model): } def __init__(self, resources=None): + super(Topology, self).__init__() self.id = None self.created_date_time = None self.last_modified = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_association.py index 456a7de8bb71..89b3e60f48f3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_association.py @@ -34,6 +34,7 @@ class TopologyAssociation(Model): } def __init__(self, name=None, resource_id=None, association_type=None): + super(TopologyAssociation, self).__init__() self.name = name self.resource_id = resource_id self.association_type = association_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_parameters.py index c2f674cad7fc..04920dc9665d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_parameters.py @@ -29,4 +29,5 @@ class TopologyParameters(Model): } def __init__(self, target_resource_group_name): + super(TopologyParameters, self).__init__() self.target_resource_group_name = target_resource_group_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_resource.py index 1e8f05d0fb4e..0907867f0997 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/topology_resource.py @@ -35,6 +35,7 @@ class TopologyResource(Model): } def __init__(self, name=None, id=None, location=None, associations=None): + super(TopologyResource, self).__init__() self.name = name self.id = id self.location = location diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_details.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_details.py index 614bc506579e..8c5a12876b47 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_details.py @@ -37,6 +37,7 @@ class TroubleshootingDetails(Model): } def __init__(self, id=None, reason_type=None, summary=None, detail=None, recommended_actions=None): + super(TroubleshootingDetails, self).__init__() self.id = id self.reason_type = reason_type self.summary = summary diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_parameters.py index d6bd7ebe04e6..c4833fb8eeb3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_parameters.py @@ -38,6 +38,7 @@ class TroubleshootingParameters(Model): } def __init__(self, target_resource_id, storage_id, storage_path): + super(TroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.storage_path = storage_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_recommended_actions.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_recommended_actions.py index 479eb32b8fa8..cbc5e31177c7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_recommended_actions.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_recommended_actions.py @@ -35,6 +35,7 @@ class TroubleshootingRecommendedActions(Model): } def __init__(self, action_id=None, action_text=None, action_uri=None, action_uri_text=None): + super(TroubleshootingRecommendedActions, self).__init__() self.action_id = action_id self.action_text = action_text self.action_uri = action_uri diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_result.py index 1f7f562e2c69..d473f86d36d8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/troubleshooting_result.py @@ -34,6 +34,7 @@ class TroubleshootingResult(Model): } def __init__(self, start_time=None, end_time=None, code=None, results=None): + super(TroubleshootingResult, self).__init__() self.start_time = start_time self.end_time = end_time self.code = code diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/tunnel_connection_health.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/tunnel_connection_health.py index affedf32ad6c..b0ec1f39f801 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/tunnel_connection_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/tunnel_connection_health.py @@ -53,6 +53,7 @@ class TunnelConnectionHealth(Model): } def __init__(self): + super(TunnelConnectionHealth, self).__init__() self.tunnel = None self.connection_status = None self.ingress_bytes_transferred = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/usage.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/usage.py index 792196d6fdfa..6b216dff1bab 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/usage.py @@ -50,6 +50,7 @@ class Usage(Model): unit = "Count" def __init__(self, current_value, limit, name): + super(Usage, self).__init__() self.id = None self.current_value = current_value self.limit = limit diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/usage_name.py index 87786b60cf62..df7f344bfb9b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/usage_name.py @@ -27,5 +27,6 @@ class UsageName(Model): } def __init__(self, value=None, localized_value=None): + super(UsageName, self).__init__() self.value = value self.localized_value = localized_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/verification_ip_flow_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/verification_ip_flow_parameters.py index 31e943eb8596..99a3da554383 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/verification_ip_flow_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/verification_ip_flow_parameters.py @@ -66,6 +66,7 @@ class VerificationIPFlowParameters(Model): } def __init__(self, target_resource_id, direction, protocol, local_port, remote_port, local_ip_address, remote_ip_address, target_nic_resource_id=None): + super(VerificationIPFlowParameters, self).__init__() self.target_resource_id = target_resource_id self.direction = direction self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/verification_ip_flow_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/verification_ip_flow_result.py index c2d5269b99f6..b6fbc7c1ba9b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/verification_ip_flow_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/verification_ip_flow_result.py @@ -29,5 +29,6 @@ class VerificationIPFlowResult(Model): } def __init__(self, access=None, rule_name=None): + super(VerificationIPFlowResult, self).__init__() self.access = access self.rule_name = rule_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_connection_gateway_reference.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_connection_gateway_reference.py index f50295906ad8..eb18a3c124ff 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_connection_gateway_reference.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_connection_gateway_reference.py @@ -29,4 +29,5 @@ class VirtualNetworkConnectionGatewayReference(Model): } def __init__(self, id): + super(VirtualNetworkConnectionGatewayReference, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_gateway_sku.py index d830da51425f..0089fe3d5399 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_gateway_sku.py @@ -36,6 +36,7 @@ class VirtualNetworkGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(VirtualNetworkGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_usage.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_usage.py index 72fe6ad19529..e229cfeab24e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_usage.py @@ -48,6 +48,7 @@ class VirtualNetworkUsage(Model): } def __init__(self): + super(VirtualNetworkUsage, self).__init__() self.current_value = None self.id = None self.limit = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_usage_name.py index dd93c0846a5c..01fcbf0875eb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_usage_name.py @@ -35,5 +35,6 @@ class VirtualNetworkUsageName(Model): } def __init__(self): + super(VirtualNetworkUsageName, self).__init__() self.localized_value = None self.value = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_client_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_client_configuration.py index 58fbec650e37..76dbc6aa30db 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_client_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_client_configuration.py @@ -49,6 +49,7 @@ class VpnClientConfiguration(Model): } def __init__(self, vpn_client_address_pool=None, vpn_client_root_certificates=None, vpn_client_revoked_certificates=None, vpn_client_protocols=None, radius_server_address=None, radius_server_secret=None): + super(VpnClientConfiguration, self).__init__() self.vpn_client_address_pool = vpn_client_address_pool self.vpn_client_root_certificates = vpn_client_root_certificates self.vpn_client_revoked_certificates = vpn_client_revoked_certificates diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_client_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_client_parameters.py index 4ca23cb8395a..7aaa29750ed2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_client_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_client_parameters.py @@ -43,6 +43,7 @@ class VpnClientParameters(Model): } def __init__(self, processor_architecture=None, authentication_method=None, radius_server_auth_certificate=None, client_root_certificates=None): + super(VpnClientParameters, self).__init__() self.processor_architecture = processor_architecture self.authentication_method = authentication_method self.radius_server_auth_certificate = radius_server_auth_certificate diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_device_script_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_device_script_parameters.py index f7741841de06..89ee8af0645a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_device_script_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/vpn_device_script_parameters.py @@ -30,6 +30,7 @@ class VpnDeviceScriptParameters(Model): } def __init__(self, vendor=None, device_family=None, firmware_version=None): + super(VpnDeviceScriptParameters, self).__init__() self.vendor = vendor self.device_family = device_family self.firmware_version = firmware_version diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/network_management_client.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/network_management_client.py index 6161cf97048e..811d856a791c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/network_management_client.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/network_management_client.py @@ -311,7 +311,7 @@ def check_dns_name_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/application_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/application_gateways_operations.py index 6f69636edce7..ba33568a41f5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/application_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/application_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param parameters: Parameters supplied to the create or update - application gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.ApplicationGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ApplicationGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ApplicationGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update + application gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.ApplicationGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ApplicationGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('ApplicationGateway', response) + deserialized = self._deserialize('ApplicationGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -269,26 +319,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, application_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates the specified application gateway tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ApplicationGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, application_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -318,19 +351,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, application_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates the specified application gateway tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ApplicationGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -339,10 +423,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGateway', response) + deserialized = self._deserialize('ApplicationGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -350,10 +431,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -409,7 +486,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -473,7 +550,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -492,23 +569,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def start( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Starts the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _start_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start' path_format_arguments = { @@ -533,18 +596,58 @@ def start( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 start( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Starts the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._start_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -557,10 +660,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -568,23 +667,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Stops the specified application gateway in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop' path_format_arguments = { @@ -609,18 +694,58 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 stop( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Stops the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -633,10 +758,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -644,28 +765,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def backend_health( - self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Gets the backend health of the specified application gateway in a - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param expand: Expands BackendAddressPool and BackendHttpSettings - referenced in backend health. - :type expand: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGatewayBackendHealth or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ApplicationGatewayBackendHealth] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _backend_health_initial( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth' path_format_arguments = { @@ -692,18 +794,71 @@ def backend_health( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ApplicationGatewayBackendHealth', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def backend_health( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets the backend health of the specified application gateway in a + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param expand: Expands BackendAddressPool and BackendHttpSettings + referenced in backend health. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGatewayBackendHealth or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ApplicationGatewayBackendHealth] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._backend_health_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + expand=expand, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -712,10 +867,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) + deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -723,10 +875,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -773,7 +921,7 @@ def list_available_waf_rule_sets( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -830,7 +978,7 @@ def list_available_ssl_options( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -894,7 +1042,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -955,7 +1103,7 @@ def get_ssl_predefined_policy( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/application_security_groups_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/application_security_groups_operations.py index 704dc4995185..6cfd55d1e4ce 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/application_security_groups_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/application_security_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,24 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, application_security_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified application security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_security_group_name: The name of the application - security group. - :type application_security_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, application_security_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}' path_format_arguments = { @@ -80,18 +66,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, application_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified application security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_security_group_name: The name of the application + security group. + :type application_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -104,10 +131,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -160,7 +183,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -178,29 +201,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, application_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an application security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_security_group_name: The name of the application - security group. - :type application_security_group_name: str - :param parameters: Parameters supplied to the create or update - ApplicationSecurityGroup operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.ApplicationSecurityGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ApplicationSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, application_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}' path_format_arguments = { @@ -228,19 +231,75 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ApplicationSecurityGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, application_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an application security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_security_group_name: The name of the application + security group. + :type application_security_group_name: str + :param parameters: Parameters supplied to the create or update + ApplicationSecurityGroup operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.ApplicationSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ApplicationSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationSecurityGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('ApplicationSecurityGroup', response) + deserialized = self._deserialize('ApplicationSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/available_endpoint_services_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/available_endpoint_services_operations.py index 7dca4e62b719..e74071da6bbe 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/available_endpoint_services_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/available_endpoint_services_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/bgp_service_communities_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/bgp_service_communities_operations.py index ecef9347362d..ced26ed0a3de 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/bgp_service_communities_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/bgp_service_communities_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/default_security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/default_security_rules_operations.py index 8c5b9e5a8117..2e021b4d6ef1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/default_security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/default_security_rules_operations.py @@ -89,7 +89,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -156,7 +156,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuit_authorizations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuit_authorizations_operations.py index 701b4a396d19..477421656a89 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuit_authorizations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuit_authorizations_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified authorization from the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified authorization from the specified express route + circuit. - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,31 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an authorization in the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param authorization_parameters: Parameters supplied to the create or - update express route circuit authorization operation. - :type authorization_parameters: - ~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitAuthorization - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitAuthorization] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -238,19 +240,78 @@ def create_or_update( body_content = self._serialize.body(authorization_parameters, 'ExpressRouteCircuitAuthorization') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization in the specified express route + circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or + update express route circuit authorization operation. + :type authorization_parameters: + ~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitAuthorization + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitAuthorization] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + authorization_parameters=authorization_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -259,12 +320,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -272,10 +328,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuit_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuit_peerings_operations.py index 0cd1c8df5f47..bd8646c82217 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuit_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuit_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified peering from the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified peering from the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified express route circuits. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param peering_parameters: Parameters supplied to the create or update - express route circuit peering operation. - :type peering_parameters: - ~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(peering_parameters, 'ExpressRouteCircuitPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + express route circuit peering operation. + :type peering_parameters: + ~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + peering_parameters=peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuits_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuits_operations.py index 631436ba7188..fcf2cf286960 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuits_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_circuits_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def delete( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the circuit. - :type circuit_name: str - :param parameters: Parameters supplied to the create or update express - route circuit operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuit - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuit or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuit] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ExpressRouteCircuit') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuit', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuit', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the circuit. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express + route circuit operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuit + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuit or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuit] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuit', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuit', response) + deserialized = self._deserialize('ExpressRouteCircuit', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -269,26 +319,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, circuit_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates an express route circuit tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the circuit. - :type circuit_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuit or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuit] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, circuit_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -318,19 +351,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuit', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, circuit_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates an express route circuit tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the circuit. + :type circuit_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuit or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuit] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -339,10 +423,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuit', response) + deserialized = self._deserialize('ExpressRouteCircuit', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -350,10 +431,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -361,30 +438,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_arp_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised ARP table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsArpTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitsArpTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_arp_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}' path_format_arguments = { @@ -411,18 +467,74 @@ def list_arp_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsArpTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_arp_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised ARP table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsArpTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitsArpTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_arp_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -431,10 +543,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -442,10 +551,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -453,30 +558,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitsRoutesTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}' path_format_arguments = { @@ -503,18 +587,74 @@ def list_routes_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsRoutesTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table associated with the express + route circuit in a resource group. - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitsRoutesTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -523,10 +663,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -534,10 +671,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -545,30 +678,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table_summary( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table summary associated with the - express route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse - if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_summary_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}' path_format_arguments = { @@ -595,18 +707,74 @@ def list_routes_table_summary( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table_summary( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table summary associated with the + express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse + if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -615,10 +783,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -626,10 +791,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -681,7 +842,7 @@ def get_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -746,7 +907,7 @@ def get_peering_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -812,7 +973,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -876,7 +1037,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_service_providers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_service_providers_operations.py index 7e10e2b6a5d5..3176e462d554 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_service_providers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/express_route_service_providers_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/inbound_nat_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/inbound_nat_rules_operations.py index f78821137941..81df0094ade1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/inbound_nat_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/inbound_nat_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -108,25 +109,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def delete( - self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer inbound nat rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param inbound_nat_rule_name: The name of the inbound nat rule. - :type inbound_nat_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}' path_format_arguments = { @@ -152,18 +137,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer inbound nat rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound nat rule. + :type inbound_nat_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -176,10 +204,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -237,7 +261,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -255,30 +279,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer inbound nat rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param inbound_nat_rule_name: The name of the inbound nat rule. - :type inbound_nat_rule_name: str - :param inbound_nat_rule_parameters: Parameters supplied to the create - or update inbound nat rule operation. - :type inbound_nat_rule_parameters: - ~azure.mgmt.network.v2017_09_01.models.InboundNatRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - InboundNatRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.InboundNatRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}' path_format_arguments = { @@ -307,19 +310,77 @@ def create_or_update( body_content = self._serialize.body(inbound_nat_rule_parameters, 'InboundNatRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('InboundNatRule', response) + if response.status_code == 201: + deserialized = self._deserialize('InboundNatRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer inbound nat rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound nat rule. + :type inbound_nat_rule_name: str + :param inbound_nat_rule_parameters: Parameters supplied to the create + or update inbound nat rule operation. + :type inbound_nat_rule_parameters: + ~azure.mgmt.network.v2017_09_01.models.InboundNatRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + InboundNatRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.InboundNatRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + inbound_nat_rule_parameters=inbound_nat_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -328,12 +389,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('InboundNatRule', response) - if response.status_code == 201: - deserialized = self._deserialize('InboundNatRule', response) + deserialized = self._deserialize('InboundNatRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -341,10 +397,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_backend_address_pools_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_backend_address_pools_operations.py index c6de270ed819..fc0c53d5dabe 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_backend_address_pools_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_backend_address_pools_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -154,7 +154,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_frontend_ip_configurations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_frontend_ip_configurations_operations.py index 0df3ba48f7f9..aee08565c6bf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_frontend_ip_configurations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_frontend_ip_configurations_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -154,7 +154,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_load_balancing_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_load_balancing_rules_operations.py index 817109d02001..cbdeac92b1ec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_load_balancing_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_load_balancing_rules_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -153,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_network_interfaces_operations.py index b809f0289d85..0b35ffe81e0a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_network_interfaces_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_probes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_probes_operations.py index 8a37aa2f8912..ff2489e8176b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_probes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancer_probes_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -153,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancers_operations.py index 5fc2256a9f69..fedc1bcd6982 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/load_balancers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param parameters: Parameters supplied to the create or update load - balancer operation. - :type parameters: ~azure.mgmt.network.v2017_09_01.models.LoadBalancer - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns LoadBalancer - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.LoadBalancer] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LoadBalancer') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LoadBalancer', response) + if response.status_code == 201: + deserialized = self._deserialize('LoadBalancer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load + balancer operation. + :type parameters: ~azure.mgmt.network.v2017_09_01.models.LoadBalancer + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns LoadBalancer + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.LoadBalancer] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LoadBalancer', response) - if response.status_code == 201: - deserialized = self._deserialize('LoadBalancer', response) + deserialized = self._deserialize('LoadBalancer', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -272,26 +322,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, load_balancer_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a load balancer tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns LoadBalancer - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.LoadBalancer] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, load_balancer_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -321,19 +354,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LoadBalancer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, load_balancer_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a load balancer tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns LoadBalancer + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.LoadBalancer] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -342,10 +426,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LoadBalancer', response) + deserialized = self._deserialize('LoadBalancer', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -353,10 +434,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -409,7 +486,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -476,7 +553,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/local_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/local_network_gateways_operations.py index 2735b6337996..1d43fe7963a4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/local_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/local_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a local network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param parameters: Parameters supplied to the create or update local - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.LocalNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - LocalNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.LocalNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LocalNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocalNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('LocalNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a local network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.LocalNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + LocalNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.LocalNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LocalNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('LocalNetworkGateway', response) + deserialized = self._deserialize('LocalNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified local network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified local network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,27 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, local_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a local network gateway tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - LocalNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.LocalNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, local_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -323,19 +355,71 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocalNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, local_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a local network gateway tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + LocalNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.LocalNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -344,10 +428,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LocalNetworkGateway', response) + deserialized = self._deserialize('LocalNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -355,10 +436,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -414,7 +491,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interface_ip_configurations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interface_ip_configurations_operations.py index 60381fa81b4d..8253ba4741db 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interface_ip_configurations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interface_ip_configurations_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -155,7 +155,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interface_load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interface_load_balancers_operations.py index 541b4d3d0523..192d27b90d47 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interface_load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interface_load_balancers_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interfaces_operations.py index 9e57acb34d73..82ea96c3fd96 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_interfaces_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -36,23 +37,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-09-01" # Construct URL @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,28 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param parameters: Parameters supplied to the create or update network - interface operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.NetworkInterface - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkInterface or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.NetworkInterface] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2017-09-01" # Construct URL @@ -232,19 +236,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkInterface') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkInterface', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkInterface', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network + interface operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.NetworkInterface + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkInterface or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.NetworkInterface] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkInterface', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkInterface', response) + deserialized = self._deserialize('NetworkInterface', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -277,26 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, network_interface_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a network interface tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkInterface or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.NetworkInterface] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, network_interface_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) api_version = "2017-09-01" @@ -328,19 +361,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkInterface', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, network_interface_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a network interface tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkInterface or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.NetworkInterface] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -349,10 +433,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkInterface', response) + deserialized = self._deserialize('NetworkInterface', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -360,10 +441,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -418,7 +495,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -487,7 +564,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -506,24 +583,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def get_effective_route_table( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all route tables applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.EffectiveRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_effective_route_table_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-09-01" # Construct URL @@ -550,18 +612,66 @@ def get_effective_route_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code == 200: + deserialized = self._deserialize('EffectiveRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_effective_route_table( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all route tables applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.EffectiveRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_effective_route_table_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -570,10 +680,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveRouteListResult', response) + deserialized = self._deserialize('EffectiveRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -581,10 +688,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -592,25 +695,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_effective_network_security_groups( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all network security groups applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveNetworkSecurityGroupListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.EffectiveNetworkSecurityGroupListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_effective_network_security_groups_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-09-01" # Construct URL @@ -637,18 +724,67 @@ def list_effective_network_security_groups( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveNetworkSecurityGroupListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_effective_network_security_groups( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all network security groups applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveNetworkSecurityGroupListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.EffectiveNetworkSecurityGroupListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_effective_network_security_groups_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -657,10 +793,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) + deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -668,10 +801,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -737,7 +866,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -810,7 +939,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -885,7 +1014,7 @@ def get_virtual_machine_scale_set_network_interface( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -968,7 +1097,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -1049,7 +1178,7 @@ def get_virtual_machine_scale_set_ip_configuration( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_security_groups_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_security_groups_operations.py index c5f85b2a102c..9f92b09e83d3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_security_groups_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_security_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,24 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -80,18 +66,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -104,10 +131,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network security group in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param parameters: Parameters supplied to the create or update network - security group operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.NetworkSecurityGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.NetworkSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -232,19 +234,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkSecurityGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network security group in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network + security group operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.NetworkSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.NetworkSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkSecurityGroup', response) + deserialized = self._deserialize('NetworkSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -277,27 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, network_security_group_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a network security group tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.NetworkSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, network_security_group_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -327,19 +359,71 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, network_security_group_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a network security group tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.NetworkSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -348,10 +432,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityGroup', response) + deserialized = self._deserialize('NetworkSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -359,10 +440,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -415,7 +492,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -482,7 +559,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_watchers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_watchers_operations.py index 6cbbcef4ec39..4bf10f04845a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_watchers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_watchers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -152,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -170,23 +171,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network watcher resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}' path_format_arguments = { @@ -211,18 +198,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network watcher resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -235,10 +262,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -297,7 +320,7 @@ def update_tags( # Construct and send request request = self._client.patch(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -363,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -427,7 +450,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -498,7 +521,7 @@ def get_topology( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -516,28 +539,9 @@ def get_topology( return deserialized - def verify_ip_flow( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Verify IP flow from the specified VM to a location given the currently - configured NSG rules. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the IP flow to be verified. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.VerificationIPFlowParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VerificationIPFlowResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VerificationIPFlowResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _verify_ip_flow_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify' path_format_arguments = { @@ -565,19 +569,74 @@ def verify_ip_flow( body_content = self._serialize.body(parameters, 'VerificationIPFlowParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('VerificationIPFlowResult', response) + if response.status_code == 202: + deserialized = self._deserialize('VerificationIPFlowResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def verify_ip_flow( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Verify IP flow from the specified VM to a location given the currently + configured NSG rules. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.VerificationIPFlowParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VerificationIPFlowResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VerificationIPFlowResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._verify_ip_flow_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -586,12 +645,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VerificationIPFlowResult', response) - if response.status_code == 202: - deserialized = self._deserialize('VerificationIPFlowResult', response) + deserialized = self._deserialize('VerificationIPFlowResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -599,10 +653,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -610,28 +660,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_next_hop( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Gets the next hop from the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the source and destination - endpoint. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.NextHopParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NextHopResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.NextHopResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_next_hop_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop' path_format_arguments = { @@ -659,19 +690,74 @@ def get_next_hop( body_content = self._serialize.body(parameters, 'NextHopParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('NextHopResult', response) + if response.status_code == 202: + deserialized = self._deserialize('NextHopResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_next_hop( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination + endpoint. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.NextHopParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NextHopResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.NextHopResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_next_hop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -680,12 +766,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NextHopResult', response) - if response.status_code == 202: - deserialized = self._deserialize('NextHopResult', response) + deserialized = self._deserialize('NextHopResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -693,10 +774,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -704,27 +781,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_vm_security_rules( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Gets the configured and effective security group rules on the specified - VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param target_resource_id: ID of the target VM. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - SecurityGroupViewResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.SecurityGroupViewResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_vm_security_rules_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.SecurityGroupViewParameters(target_resource_id=target_resource_id) # Construct URL @@ -754,19 +813,73 @@ def get_vm_security_rules( body_content = self._serialize.body(parameters, 'SecurityGroupViewParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('SecurityGroupViewResult', response) + if response.status_code == 202: + deserialized = self._deserialize('SecurityGroupViewResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_vm_security_rules( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the configured and effective security group rules on the specified + VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param target_resource_id: ID of the target VM. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + SecurityGroupViewResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.SecurityGroupViewResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_vm_security_rules_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -775,12 +888,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityGroupViewResult', response) - if response.status_code == 202: - deserialized = self._deserialize('SecurityGroupViewResult', response) + deserialized = self._deserialize('SecurityGroupViewResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -788,10 +896,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -799,28 +903,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Initiate troubleshooting on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the resource to - troubleshoot. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.TroubleshootingParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot' path_format_arguments = { @@ -848,19 +933,74 @@ def get_troubleshooting( body_content = self._serialize.body(parameters, 'TroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to + troubleshoot. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.TroubleshootingParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -869,12 +1009,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -882,10 +1017,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -893,27 +1024,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting_result( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Get the last completed troubleshooting result on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource ID to query the - troubleshooting result. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_result_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.QueryTroubleshootingParameters(target_resource_id=target_resource_id) # Construct URL @@ -943,19 +1056,73 @@ def get_troubleshooting_result( body_content = self._serialize.body(parameters, 'QueryTroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting_result( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource ID to query the + troubleshooting result. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_result_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -964,12 +1131,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -977,10 +1139,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -988,29 +1146,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_flow_log_configuration( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Configures flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that define the configuration of flow - log. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.FlowLogInformation - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_flow_log_configuration_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog' path_format_arguments = { @@ -1038,19 +1176,75 @@ def set_flow_log_configuration( body_content = self._serialize.body(parameters, 'FlowLogInformation') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_flow_log_configuration( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Configures flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the configuration of flow + log. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.FlowLogInformation + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_flow_log_configuration_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1059,12 +1253,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1072,10 +1261,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1083,28 +1268,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_flow_log_status( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Queries status of flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource where getting the flow - logging status. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_flow_log_status_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.FlowLogStatusParameters(target_resource_id=target_resource_id) # Construct URL @@ -1134,19 +1300,74 @@ def get_flow_log_status( body_content = self._serialize.body(parameters, 'FlowLogStatusParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_flow_log_status( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Queries status of flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource where getting the flow + logging status. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_flow_log_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1155,12 +1376,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1168,10 +1384,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1179,33 +1391,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def check_connectivity( - self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): - """Verifies the possibility of establishing a direct TCP connection from a - virtual machine to a given endpoint including another VM or an - arbitrary remote server. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param source: - :type source: - ~azure.mgmt.network.v2017_09_01.models.ConnectivitySource - :param destination: - :type destination: - ~azure.mgmt.network.v2017_09_01.models.ConnectivityDestination - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectivityInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ConnectivityInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _check_connectivity_initial( + self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectivityParameters(source=source, destination=destination) # Construct URL @@ -1235,19 +1423,80 @@ def check_connectivity( body_content = self._serialize.body(parameters, 'ConnectivityParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectivityInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('ConnectivityInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def check_connectivity( + self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): + """Verifies the possibility of establishing a direct TCP connection from a + virtual machine to a given endpoint including another VM or an + arbitrary remote server. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param source: + :type source: + ~azure.mgmt.network.v2017_09_01.models.ConnectivitySource + :param destination: + :type destination: + ~azure.mgmt.network.v2017_09_01.models.ConnectivityDestination + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectivityInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ConnectivityInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._check_connectivity_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + source=source, + destination=destination, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1256,12 +1505,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectivityInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('ConnectivityInformation', response) + deserialized = self._deserialize('ConnectivityInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1269,10 +1513,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1280,30 +1520,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_azure_reachability_report( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Gets the relative latency score for internet service providers from a - specified location to Azure regions. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that determine Azure reachability report - configuration. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.AzureReachabilityReportParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - AzureReachabilityReport or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.AzureReachabilityReport] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_azure_reachability_report_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport' path_format_arguments = { @@ -1331,19 +1550,76 @@ def get_azure_reachability_report( body_content = self._serialize.body(parameters, 'AzureReachabilityReportParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('AzureReachabilityReport', response) + if response.status_code == 202: + deserialized = self._deserialize('AzureReachabilityReport', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_azure_reachability_report( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Gets the relative latency score for internet service providers from a + specified location to Azure regions. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that determine Azure reachability report + configuration. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.AzureReachabilityReportParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + AzureReachabilityReport or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.AzureReachabilityReport] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_azure_reachability_report_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1352,12 +1628,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AzureReachabilityReport', response) - if response.status_code == 202: - deserialized = self._deserialize('AzureReachabilityReport', response) + deserialized = self._deserialize('AzureReachabilityReport', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1365,10 +1636,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1376,30 +1643,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_available_providers( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Lists all available internet service providers for a specified Azure - region. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that scope the list of available - providers. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.AvailableProvidersListParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - AvailableProvidersList or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.AvailableProvidersList] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_available_providers_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList' path_format_arguments = { @@ -1427,19 +1673,76 @@ def list_available_providers( body_content = self._serialize.body(parameters, 'AvailableProvidersListParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('AvailableProvidersList', response) + if response.status_code == 202: + deserialized = self._deserialize('AvailableProvidersList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_available_providers( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Lists all available internet service providers for a specified Azure + region. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that scope the list of available + providers. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.AvailableProvidersListParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + AvailableProvidersList or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.AvailableProvidersList] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_available_providers_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1448,12 +1751,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AvailableProvidersList', response) - if response.status_code == 202: - deserialized = self._deserialize('AvailableProvidersList', response) + deserialized = self._deserialize('AvailableProvidersList', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1461,10 +1759,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/operations.py index 3d2a18b4025d..bc015912686b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/operations.py @@ -78,7 +78,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/packet_captures_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/packet_captures_operations.py index 6783f495de91..47abde3c45a3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/packet_captures_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/packet_captures_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,29 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create( - self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create and start a packet capture on the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param parameters: Parameters that define the create packet capture - operation. - :type parameters: ~azure.mgmt.network.v2017_09_01.models.PacketCapture - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.PacketCaptureResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -89,19 +70,74 @@ def create( body_content = self._serialize.body(parameters, 'PacketCapture') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('PacketCaptureResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture + operation. + :type parameters: ~azure.mgmt.network.v2017_09_01.models.PacketCapture + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.PacketCaptureResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,10 +146,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('PacketCaptureResult', response) + deserialized = self._deserialize('PacketCaptureResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -121,10 +154,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +207,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,25 +225,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -240,18 +253,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -264,10 +320,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -275,25 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Stops a specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop' path_format_arguments = { @@ -319,18 +355,61 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 stop( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Stops a specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +422,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -354,27 +429,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_status( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Query the status of a running packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the Network Watcher resource. - :type network_watcher_name: str - :param packet_capture_name: The name given to the packet capture - session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureQueryStatusResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.PacketCaptureQueryStatusResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_status_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus' path_format_arguments = { @@ -400,18 +457,72 @@ def get_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('PacketCaptureQueryStatusResult', response) + if response.status_code == 202: + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_status( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Query the status of a running packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param packet_capture_name: The name given to the packet capture + session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureQueryStatusResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.PacketCaptureQueryStatusResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -420,12 +531,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) - if response.status_code == 202: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -433,10 +539,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -495,7 +597,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/public_ip_addresses_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/public_ip_addresses_operations.py index fa1037557a3a..7a64976ce8eb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/public_ip_addresses_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/public_ip_addresses_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -36,23 +37,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the subnet. - :type public_ip_address_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-09-01" # Construct URL @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the subnet. + :type public_ip_address_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,28 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a static or dynamic public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the public IP address. - :type public_ip_address_name: str - :param parameters: Parameters supplied to the create or update public - IP address operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.PublicIPAddress - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PublicIPAddress or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.PublicIPAddress] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2017-09-01" # Construct URL @@ -232,19 +236,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'PublicIPAddress') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PublicIPAddress', response) + if response.status_code == 201: + deserialized = self._deserialize('PublicIPAddress', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public + IP address operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.PublicIPAddress + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PublicIPAddress or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.PublicIPAddress] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PublicIPAddress', response) - if response.status_code == 201: - deserialized = self._deserialize('PublicIPAddress', response) + deserialized = self._deserialize('PublicIPAddress', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -277,26 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, public_ip_address_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates public IP address tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the public IP address. - :type public_ip_address_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PublicIPAddress or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.PublicIPAddress] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, public_ip_address_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) api_version = "2017-09-01" @@ -328,19 +361,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PublicIPAddress', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, public_ip_address_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates public IP address tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. + :type public_ip_address_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PublicIPAddress or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.PublicIPAddress] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -349,10 +433,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PublicIPAddress', response) + deserialized = self._deserialize('PublicIPAddress', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -360,10 +441,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -418,7 +495,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -487,7 +564,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -561,7 +638,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -644,7 +721,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -725,7 +802,7 @@ def get_virtual_machine_scale_set_public_ip_address( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_filter_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_filter_rules_operations.py index 6d361448854a..dedaf77e6c95 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_filter_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_filter_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified rule from a route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the rule. - :type rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified rule from a route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the create - or update route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2017_09_01.models.RouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -233,19 +236,77 @@ def create_or_update( body_content = self._serialize.body(route_filter_rule_parameters, 'RouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create + or update route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2017_09_01.models.RouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -254,12 +315,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -267,10 +323,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -278,30 +330,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the update - route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2017_09_01.models.PatchRouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -330,19 +361,75 @@ def update( body_content = self._serialize.body(route_filter_rule_parameters, 'PatchRouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the update + route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2017_09_01.models.PatchRouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -351,10 +438,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -362,10 +446,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -424,7 +504,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_filters_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_filters_operations.py index 222a4b9d9eb8..f7f3b17f3666 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_filters_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_filters_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the create or - update route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2017_09_01.models.RouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(route_filter_parameters, 'RouteFilter') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or + update route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2017_09_01.models.RouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,28 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the update - route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2017_09_01.models.PatchRouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -322,19 +353,72 @@ def update( body_content = self._serialize.body(route_filter_parameters, 'PatchRouteFilter') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the update + route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2017_09_01.models.PatchRouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +427,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -354,10 +435,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -413,7 +490,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -477,7 +554,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_tables_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_tables_operations.py index f015797b665b..9a5d360d1fa3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_tables_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/route_tables_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create or updates a route table in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param parameters: Parameters supplied to the create or update route - table operation. - :type parameters: ~azure.mgmt.network.v2017_09_01.models.RouteTable - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteTable - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteTable] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'RouteTable') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteTable', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route + table operation. + :type parameters: ~azure.mgmt.network.v2017_09_01.models.RouteTable + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteTable + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteTable] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteTable', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteTable', response) + deserialized = self._deserialize('RouteTable', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -272,26 +322,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, route_table_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a route table tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteTable - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteTable] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, route_table_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -321,19 +354,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, route_table_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a route table tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteTable + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.RouteTable] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -342,10 +426,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteTable', response) + deserialized = self._deserialize('RouteTable', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -353,10 +434,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -412,7 +489,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -476,7 +553,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/routes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/routes_operations.py index bfd0541b6b93..8c0a5672bae4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/routes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/routes_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route from a route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route from a route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,29 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param route_parameters: Parameters supplied to the create or update - route operation. - :type route_parameters: ~azure.mgmt.network.v2017_09_01.models.Route - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Route or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.Route] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -232,19 +236,76 @@ def create_or_update( body_content = self._serialize.body(route_parameters, 'Route') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Route', response) + if response.status_code == 201: + deserialized = self._deserialize('Route', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update + route operation. + :type route_parameters: ~azure.mgmt.network.v2017_09_01.models.Route + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Route or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.Route] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + route_parameters=route_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +314,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Route', response) - if response.status_code == 201: - deserialized = self._deserialize('Route', response) + deserialized = self._deserialize('Route', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +322,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -328,7 +380,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/security_rules_operations.py index bbc2c82cc48f..eb0dcb7209b5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/security_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,32 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a security rule in the specified network security - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param security_rule_parameters: Parameters supplied to the create or - update network security rule operation. - :type security_rule_parameters: - ~azure.mgmt.network.v2017_09_01.models.SecurityRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns SecurityRule - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.SecurityRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -237,19 +238,79 @@ def create_or_update( body_content = self._serialize.body(security_rule_parameters, 'SecurityRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SecurityRule', response) + if response.status_code == 201: + deserialized = self._deserialize('SecurityRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a security rule in the specified network security + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or + update network security rule operation. + :type security_rule_parameters: + ~azure.mgmt.network.v2017_09_01.models.SecurityRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns SecurityRule + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.SecurityRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + security_rule_parameters=security_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -258,12 +319,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityRule', response) - if response.status_code == 201: - deserialized = self._deserialize('SecurityRule', response) + deserialized = self._deserialize('SecurityRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -271,10 +327,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/subnets_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/subnets_operations.py index f670751c6028..cf06eeacf294 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/subnets_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/subnets_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified subnet. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified subnet. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,29 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a subnet in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param subnet_parameters: Parameters supplied to the create or update - subnet operation. - :type subnet_parameters: ~azure.mgmt.network.v2017_09_01.models.Subnet - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Subnet or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.Subnet] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -236,19 +240,76 @@ def create_or_update( body_content = self._serialize.body(subnet_parameters, 'Subnet') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Subnet', response) + if response.status_code == 201: + deserialized = self._deserialize('Subnet', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update + subnet operation. + :type subnet_parameters: ~azure.mgmt.network.v2017_09_01.models.Subnet + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Subnet or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.Subnet] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subnet_parameters=subnet_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -257,12 +318,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Subnet', response) - if response.status_code == 201: - deserialized = self._deserialize('Subnet', response) + deserialized = self._deserialize('Subnet', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -270,10 +326,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -332,7 +384,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/usages_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/usages_operations.py index ca3615b85989..f2cdaef8e1e4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/usages_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/usages_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_gateway_connections_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_gateway_connections_operations.py index e512b392980a..eaaeba931986 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_gateway_connections_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_gateway_connections_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway connection in the - specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param parameters: Parameters supplied to the create or update virtual - network gateway connection operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGatewayConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGatewayConnection or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGatewayConnection] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGatewayConnection') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway connection in the + specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual + network gateway connection operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGatewayConnection + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGatewayConnection or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGatewayConnection] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -181,7 +209,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -199,24 +227,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network Gateway connection. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -241,18 +254,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network Gateway connection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -265,10 +319,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -276,28 +326,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, virtual_network_gateway_connection_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a virtual network gateway connection tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGatewayConnectionListEntity or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGatewayConnectionListEntity] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, virtual_network_gateway_connection_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -327,19 +358,72 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGatewayConnectionListEntity', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, virtual_network_gateway_connection_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a virtual network gateway connection tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGatewayConnectionListEntity or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGatewayConnectionListEntity] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -348,10 +432,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGatewayConnectionListEntity', response) + deserialized = self._deserialize('VirtualNetworkGatewayConnectionListEntity', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -359,10 +440,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -370,30 +447,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): - """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection name. - :type virtual_network_gateway_connection_name: str - :param value: The virtual network connection shared key value. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ConnectionSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionSharedKey(value=value) # Construct URL @@ -423,19 +479,76 @@ def set_shared_key( body_content = self._serialize.body(parameters, 'ConnectionSharedKey') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConnectionSharedKey', response) + if response.status_code == 201: + deserialized = self._deserialize('ConnectionSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection name. + :type virtual_network_gateway_connection_name: str + :param value: The virtual network connection shared key value. + :type value: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ConnectionSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + value=value, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -444,12 +557,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionSharedKey', response) - if response.status_code == 201: - deserialized = self._deserialize('ConnectionSharedKey', response) + deserialized = self._deserialize('ConnectionSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -457,10 +565,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -514,7 +618,7 @@ def get_shared_key( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -581,7 +685,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -600,31 +704,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): - """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection reset shared key Name. - :type virtual_network_gateway_connection_name: str - :param key_length: The virtual network connection reset shared key - length, should between 1 and 128. - :type key_length: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionResetSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ConnectionResetSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionResetSharedKey(key_length=key_length) # Construct URL @@ -654,19 +736,75 @@ def reset_shared_key( body_content = self._serialize.body(parameters, 'ConnectionResetSharedKey') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectionResetSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection reset shared key Name. + :type virtual_network_gateway_connection_name: str + :param key_length: The virtual network connection reset shared key + length, should between 1 and 128. + :type key_length: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionResetSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.ConnectionResetSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + key_length=key_length, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -675,10 +813,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionResetSharedKey', response) + deserialized = self._deserialize('ConnectionResetSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -686,10 +821,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_gateways_operations.py index b169f9d34e8d..9e3ceb4b3a82 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to create or update virtual - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,27 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, virtual_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a virtual network gateway tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, virtual_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -323,19 +355,71 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, virtual_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a virtual network gateway tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -344,10 +428,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -355,10 +436,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -414,7 +491,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -486,7 +563,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -505,29 +582,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset( - self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): - """Resets the primary of the virtual network gateway in the specified - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param gateway_vip: Virtual network gateway vip address supplied to - the begin reset of the active-active feature enabled gateway. - :type gateway_vip: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_initial( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset' path_format_arguments = { @@ -554,71 +611,98 @@ def reset( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - deserialized = None + deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - return deserialized + return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - - def generatevpnclientpackage( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Generates VPN client package for P2S client of the virtual network - gateway in the specified resource group. + def reset( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): + """Resets the primary of the virtual network gateway in the specified + resource group. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param virtual_network_gateway_name: The name of the virtual network gateway. :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to the generate virtual network - gateway VPN client package operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.VpnClientParameters + :param gateway_vip: Virtual network gateway vip address supplied to + the begin reset of the active-active feature enabled gateway. + :type gateway_vip: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :return: An instance of AzureOperationPoller that returns str or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or - ~msrest.pipeline.ClientRawResponse + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + raw_result = self._reset_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + gateway_vip=gateway_vip, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + + def _generatevpnclientpackage_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage' path_format_arguments = { @@ -646,19 +730,73 @@ def generatevpnclientpackage( body_content = self._serialize.body(parameters, 'VpnClientParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def generatevpnclientpackage( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Generates VPN client package for P2S client of the virtual network + gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network + gateway VPN client package operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.VpnClientParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns str or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._generatevpnclientpackage_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -667,10 +805,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -678,10 +813,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -689,30 +820,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def generate_vpn_profile( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Generates VPN profile for P2S client of the virtual network gateway in - the specified resource group. Used for IKEV2 and radius based - authentication. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to the generate virtual network - gateway VPN client package operation. - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.VpnClientParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns str or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _generate_vpn_profile_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile' path_format_arguments = { @@ -740,19 +850,74 @@ def generate_vpn_profile( body_content = self._serialize.body(parameters, 'VpnClientParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def generate_vpn_profile( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Generates VPN profile for P2S client of the virtual network gateway in + the specified resource group. Used for IKEV2 and radius based + authentication. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network + gateway VPN client package operation. + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.VpnClientParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns str or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._generate_vpn_profile_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -761,10 +926,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -772,10 +934,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -783,26 +941,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_vpn_profile_package_url( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Gets pre-generated VPN profile for P2S client of the virtual network - gateway in the specified resource group. The profile needs to be - generated first using generateVpnProfile. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns str or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_vpn_profile_package_url_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl' path_format_arguments = { @@ -827,18 +968,68 @@ def get_vpn_profile_package_url( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def get_vpn_profile_package_url( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Gets pre-generated VPN profile for P2S client of the virtual network + gateway in the specified resource group. The profile needs to be + generated first using generateVpnProfile. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns str or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_vpn_profile_package_url_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -847,10 +1038,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -858,10 +1046,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -869,27 +1053,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_bgp_peer_status( - self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): - """The GetBgpPeerStatus operation retrieves the status of all BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer to retrieve the status of. - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - BgpPeerStatusListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.BgpPeerStatusListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_bgp_peer_status_initial( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus' path_format_arguments = { @@ -916,18 +1082,70 @@ def get_bgp_peer_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BgpPeerStatusListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_bgp_peer_status( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): + """The GetBgpPeerStatus operation retrieves the status of all BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer to retrieve the status of. + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + BgpPeerStatusListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.BgpPeerStatusListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_bgp_peer_status_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -936,10 +1154,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BgpPeerStatusListResult', response) + deserialized = self._deserialize('BgpPeerStatusListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -947,10 +1162,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1001,7 +1212,7 @@ def supported_vpn_devices( # Construct and send request request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -1019,26 +1230,9 @@ def supported_vpn_devices( return deserialized - def get_learned_routes( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - has learned, including routes learned from BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_learned_routes_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes' path_format_arguments = { @@ -1063,18 +1257,68 @@ def get_learned_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_learned_routes( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + has learned, including routes learned from BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_learned_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1083,10 +1327,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1094,10 +1335,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1105,28 +1342,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_advertised_routes( - self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - is advertising to the specified peer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_advertised_routes_initial( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes' path_format_arguments = { @@ -1152,18 +1370,71 @@ def get_advertised_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_advertised_routes( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + is advertising to the specified peer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_advertised_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1172,10 +1443,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1183,10 +1451,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1246,7 +1510,7 @@ def vpn_device_configuration_script( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_peerings_operations.py index 22f4affc46d0..5374eaf3ec4b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_network_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network peering. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the virtual network - peering. - :type virtual_network_peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network + peering. + :type virtual_network_peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the peering. - :type virtual_network_peering_name: str - :param virtual_network_peering_parameters: Parameters supplied to the - create or update virtual network peering operation. - :type virtual_network_peering_parameters: - ~azure.mgmt.network.v2017_09_01.models.VirtualNetworkPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(virtual_network_peering_parameters, 'VirtualNetworkPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the + create or update virtual network peering operation. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2017_09_01.models.VirtualNetworkPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetworkPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + virtual_network_peering_parameters=virtual_network_peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkPeering', response) + deserialized = self._deserialize('VirtualNetworkPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_networks_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_networks_operations.py index 7beba562b04c..6a6b81a38720 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_networks_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/virtual_networks_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network in the specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to the create or update virtual - network operation - :type parameters: - ~azure.mgmt.network.v2017_09_01.models.VirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetwork or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetwork] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetwork') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetwork', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual + network operation + :type parameters: + ~azure.mgmt.network.v2017_09_01.models.VirtualNetwork + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetwork or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetwork] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetwork', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetwork', response) + deserialized = self._deserialize('VirtualNetwork', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,26 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, virtual_network_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a virtual network tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetwork or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetwork] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, virtual_network_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -322,19 +355,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, virtual_network_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a virtual network tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetwork or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_09_01.models.VirtualNetwork] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +427,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetwork', response) + deserialized = self._deserialize('VirtualNetwork', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -354,10 +435,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -410,7 +487,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -477,7 +554,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -544,7 +621,7 @@ def check_ip_address_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -613,7 +690,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/__init__.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/__init__.py index 479821a0e332..b4bf156ebcc8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/__init__.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/__init__.py @@ -141,6 +141,13 @@ from .available_providers_list_state import AvailableProvidersListState from .available_providers_list_country import AvailableProvidersListCountry from .available_providers_list import AvailableProvidersList +from .connection_monitor_source import ConnectionMonitorSource +from .connection_monitor_destination import ConnectionMonitorDestination +from .connection_monitor_parameters import ConnectionMonitorParameters +from .connection_monitor import ConnectionMonitor +from .connection_monitor_result import ConnectionMonitorResult +from .connection_state_snapshot import ConnectionStateSnapshot +from .connection_monitor_query_result import ConnectionMonitorQueryResult from .operation_display import OperationDisplay from .availability import Availability from .dimension import Dimension @@ -202,6 +209,7 @@ from .security_rule_paged import SecurityRulePaged from .network_watcher_paged import NetworkWatcherPaged from .packet_capture_result_paged import PacketCaptureResultPaged +from .connection_monitor_result_paged import ConnectionMonitorResultPaged from .operation_paged import OperationPaged from .public_ip_address_paged import PublicIPAddressPaged from .route_filter_paged import RouteFilterPaged @@ -267,6 +275,8 @@ Severity, IssueType, ConnectionStatus, + ConnectionState, + EvaluationState, VirtualNetworkPeeringState, VirtualNetworkGatewayType, VpnType, @@ -419,6 +429,13 @@ 'AvailableProvidersListState', 'AvailableProvidersListCountry', 'AvailableProvidersList', + 'ConnectionMonitorSource', + 'ConnectionMonitorDestination', + 'ConnectionMonitorParameters', + 'ConnectionMonitor', + 'ConnectionMonitorResult', + 'ConnectionStateSnapshot', + 'ConnectionMonitorQueryResult', 'OperationDisplay', 'Availability', 'Dimension', @@ -480,6 +497,7 @@ 'SecurityRulePaged', 'NetworkWatcherPaged', 'PacketCaptureResultPaged', + 'ConnectionMonitorResultPaged', 'OperationPaged', 'PublicIPAddressPaged', 'RouteFilterPaged', @@ -544,6 +562,8 @@ 'Severity', 'IssueType', 'ConnectionStatus', + 'ConnectionState', + 'EvaluationState', 'VirtualNetworkPeeringState', 'VirtualNetworkGatewayType', 'VpnType', diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/address_space.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/address_space.py index 4ff6fb3af6d8..d7050c78a457 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/address_space.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/address_space.py @@ -26,4 +26,5 @@ class AddressSpace(Model): } def __init__(self, address_prefixes=None): + super(AddressSpace, self).__init__() self.address_prefixes = address_prefixes diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_available_waf_rule_sets_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_available_waf_rule_sets_result.py index 3b627e4cc5ed..301e3989aa59 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_available_waf_rule_sets_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_available_waf_rule_sets_result.py @@ -25,4 +25,5 @@ class ApplicationGatewayAvailableWafRuleSetsResult(Model): } def __init__(self, value=None): + super(ApplicationGatewayAvailableWafRuleSetsResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_address.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_address.py index 5ff5ce4b4a5c..6005027d0845 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_address.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_address.py @@ -27,5 +27,6 @@ class ApplicationGatewayBackendAddress(Model): } def __init__(self, fqdn=None, ip_address=None): + super(ApplicationGatewayBackendAddress, self).__init__() self.fqdn = fqdn self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health.py index 07a1d86a3f5b..5d5f14af4b4b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health.py @@ -25,4 +25,5 @@ class ApplicationGatewayBackendHealth(Model): } def __init__(self, backend_address_pools=None): + super(ApplicationGatewayBackendHealth, self).__init__() self.backend_address_pools = backend_address_pools diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_http_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_http_settings.py index 8dce4753f4fe..f1c0f7e4a7a0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_http_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_http_settings.py @@ -30,5 +30,6 @@ class ApplicationGatewayBackendHealthHttpSettings(Model): } def __init__(self, backend_http_settings=None, servers=None): + super(ApplicationGatewayBackendHealthHttpSettings, self).__init__() self.backend_http_settings = backend_http_settings self.servers = servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_pool.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_pool.py index d1ee80d169f5..012b506d2f6b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_pool.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_pool.py @@ -31,5 +31,6 @@ class ApplicationGatewayBackendHealthPool(Model): } def __init__(self, backend_address_pool=None, backend_http_settings_collection=None): + super(ApplicationGatewayBackendHealthPool, self).__init__() self.backend_address_pool = backend_address_pool self.backend_http_settings_collection = backend_http_settings_collection diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_server.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_server.py index bd0022b35528..72691f4b3b0b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_server.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_health_server.py @@ -33,6 +33,7 @@ class ApplicationGatewayBackendHealthServer(Model): } def __init__(self, address=None, ip_configuration=None, health=None): + super(ApplicationGatewayBackendHealthServer, self).__init__() self.address = address self.ip_configuration = ip_configuration self.health = health diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_connection_draining.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_connection_draining.py index e1912ca67c62..8f9b88b571e2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_connection_draining.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_connection_draining.py @@ -35,5 +35,6 @@ class ApplicationGatewayConnectionDraining(Model): } def __init__(self, enabled, drain_timeout_in_sec): + super(ApplicationGatewayConnectionDraining, self).__init__() self.enabled = enabled self.drain_timeout_in_sec = drain_timeout_in_sec diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_disabled_rule_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_disabled_rule_group.py index cac1f2bd38e0..02c88980e857 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_disabled_rule_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_disabled_rule_group.py @@ -32,5 +32,6 @@ class ApplicationGatewayFirewallDisabledRuleGroup(Model): } def __init__(self, rule_group_name, rules=None): + super(ApplicationGatewayFirewallDisabledRuleGroup, self).__init__() self.rule_group_name = rule_group_name self.rules = rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_rule.py index 74db98eb4e23..f3f7da7cc11b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_rule.py @@ -31,5 +31,6 @@ class ApplicationGatewayFirewallRule(Model): } def __init__(self, rule_id, description=None): + super(ApplicationGatewayFirewallRule, self).__init__() self.rule_id = rule_id self.description = description diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_rule_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_rule_group.py index 1d5e8aae22ab..183d465199e8 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_rule_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_firewall_rule_group.py @@ -38,6 +38,7 @@ class ApplicationGatewayFirewallRuleGroup(Model): } def __init__(self, rule_group_name, rules, description=None): + super(ApplicationGatewayFirewallRuleGroup, self).__init__() self.rule_group_name = rule_group_name self.description = description self.rules = rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_probe_health_response_match.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_probe_health_response_match.py index 4c8ddb2c0896..beaef556eb99 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_probe_health_response_match.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_probe_health_response_match.py @@ -29,5 +29,6 @@ class ApplicationGatewayProbeHealthResponseMatch(Model): } def __init__(self, body=None, status_codes=None): + super(ApplicationGatewayProbeHealthResponseMatch, self).__init__() self.body = body self.status_codes = status_codes diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_sku.py index e6c1ba023105..4a71b3f924e9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_sku.py @@ -35,6 +35,7 @@ class ApplicationGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(ApplicationGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_ssl_policy.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_ssl_policy.py index 2e1de688f900..3af04060dc18 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_ssl_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_ssl_policy.py @@ -48,6 +48,7 @@ class ApplicationGatewaySslPolicy(Model): } def __init__(self, disabled_ssl_protocols=None, policy_type=None, policy_name=None, cipher_suites=None, min_protocol_version=None): + super(ApplicationGatewaySslPolicy, self).__init__() self.disabled_ssl_protocols = disabled_ssl_protocols self.policy_type = policy_type self.policy_name = policy_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_web_application_firewall_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_web_application_firewall_configuration.py index fafb741c6a93..4184423e3032 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_web_application_firewall_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_web_application_firewall_configuration.py @@ -47,6 +47,7 @@ class ApplicationGatewayWebApplicationFirewallConfiguration(Model): } def __init__(self, enabled, firewall_mode, rule_set_type, rule_set_version, disabled_rule_groups=None): + super(ApplicationGatewayWebApplicationFirewallConfiguration, self).__init__() self.enabled = enabled self.firewall_mode = firewall_mode self.rule_set_type = rule_set_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/availability.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/availability.py index c190d9e1ec7b..c45356ed4847 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/availability.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/availability.py @@ -30,6 +30,7 @@ class Availability(Model): } def __init__(self, time_grain=None, retention=None, blob_duration=None): + super(Availability, self).__init__() self.time_grain = time_grain self.retention = retention self.blob_duration = blob_duration diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list.py index 726d525c6cfd..7e467a488605 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list.py @@ -29,4 +29,5 @@ class AvailableProvidersList(Model): } def __init__(self, countries): + super(AvailableProvidersList, self).__init__() self.countries = countries diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_city.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_city.py index 55b2f6a1b6df..cfd9fa55e297 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_city.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_city.py @@ -27,5 +27,6 @@ class AvailableProvidersListCity(Model): } def __init__(self, city_name=None, providers=None): + super(AvailableProvidersListCity, self).__init__() self.city_name = city_name self.providers = providers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_country.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_country.py index e951fe2e8749..04113d9c3db0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_country.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_country.py @@ -31,6 +31,7 @@ class AvailableProvidersListCountry(Model): } def __init__(self, country_name=None, providers=None, states=None): + super(AvailableProvidersListCountry, self).__init__() self.country_name = country_name self.providers = providers self.states = states diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_parameters.py index 6f367baa2921..4eb335e056b6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_parameters.py @@ -34,6 +34,7 @@ class AvailableProvidersListParameters(Model): } def __init__(self, azure_locations=None, country=None, state=None, city=None): + super(AvailableProvidersListParameters, self).__init__() self.azure_locations = azure_locations self.country = country self.state = state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_state.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_state.py index ac30b3310680..13719c3ad064 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_state.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/available_providers_list_state.py @@ -31,6 +31,7 @@ class AvailableProvidersListState(Model): } def __init__(self, state_name=None, providers=None, cities=None): + super(AvailableProvidersListState, self).__init__() self.state_name = state_name self.providers = providers self.cities = cities diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_async_operation_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_async_operation_result.py index 475e993e9e47..d8c040288464 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_async_operation_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_async_operation_result.py @@ -37,5 +37,6 @@ class AzureAsyncOperationResult(Model): } def __init__(self, status=None, error=None): + super(AzureAsyncOperationResult, self).__init__() self.status = status self.error = error diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report.py index 111ad225d0bc..1448a70061f9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report.py @@ -39,6 +39,7 @@ class AzureReachabilityReport(Model): } def __init__(self, aggregation_level, provider_location, reachability_report): + super(AzureReachabilityReport, self).__init__() self.aggregation_level = aggregation_level self.provider_location = provider_location self.reachability_report = reachability_report diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_item.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_item.py index 2f3306ac1b39..1bbd0c133e43 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_item.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_item.py @@ -31,6 +31,7 @@ class AzureReachabilityReportItem(Model): } def __init__(self, provider=None, azure_location=None, latencies=None): + super(AzureReachabilityReportItem, self).__init__() self.provider = provider self.azure_location = azure_location self.latencies = latencies diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_latency_info.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_latency_info.py index 4fb59f2a7a28..c4920ffb64be 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_latency_info.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_latency_info.py @@ -32,5 +32,6 @@ class AzureReachabilityReportLatencyInfo(Model): } def __init__(self, time_stamp=None, score=None): + super(AzureReachabilityReportLatencyInfo, self).__init__() self.time_stamp = time_stamp self.score = score diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_location.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_location.py index cf9d5475ae4d..0da63a04e016 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_location.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_location.py @@ -34,6 +34,7 @@ class AzureReachabilityReportLocation(Model): } def __init__(self, country, state=None, city=None): + super(AzureReachabilityReportLocation, self).__init__() self.country = country self.state = state self.city = city diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_parameters.py index 07f24a33c5f3..41de7b1d2955 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/azure_reachability_report_parameters.py @@ -43,6 +43,7 @@ class AzureReachabilityReportParameters(Model): } def __init__(self, provider_location, start_time, end_time, providers=None, azure_locations=None): + super(AzureReachabilityReportParameters, self).__init__() self.provider_location = provider_location self.providers = providers self.azure_locations = azure_locations diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_community.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_community.py index b80621009023..8275a0e4048c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_community.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_community.py @@ -43,6 +43,7 @@ class BGPCommunity(Model): } def __init__(self, service_supported_region=None, community_name=None, community_value=None, community_prefixes=None, is_authorized_to_use=None, service_group=None): + super(BGPCommunity, self).__init__() self.service_supported_region = service_supported_region self.community_name = community_name self.community_value = community_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_peer_status.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_peer_status.py index 80894eb23d52..5ee0599c38bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_peer_status.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_peer_status.py @@ -60,6 +60,7 @@ class BgpPeerStatus(Model): } def __init__(self): + super(BgpPeerStatus, self).__init__() self.local_address = None self.neighbor = None self.asn = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_peer_status_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_peer_status_list_result.py index 85fa9155a949..c987238d1369 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_peer_status_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_peer_status_list_result.py @@ -24,4 +24,5 @@ class BgpPeerStatusListResult(Model): } def __init__(self, value=None): + super(BgpPeerStatusListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_settings.py index d62cc30ab0c7..c5730da2e43e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/bgp_settings.py @@ -32,6 +32,7 @@ class BgpSettings(Model): } def __init__(self, asn=None, bgp_peering_address=None, peer_weight=None): + super(BgpSettings, self).__init__() self.asn = asn self.bgp_peering_address = bgp_peering_address self.peer_weight = peer_weight diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor.py new file mode 100644 index 000000000000..e9f8dbf5ef64 --- /dev/null +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ConnectionMonitor(Model): + """Parameters that define the operation to create a connection monitor. + + :param location: Connection monitor location. + :type location: str + :param tags: Connection monitor tags. + :type tags: dict[str, str] + :param source: + :type source: + ~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorSource + :param destination: + :type destination: + ~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorDestination + :param auto_start: Determines if the connection monitor will start + automatically once created. Default value: True . + :type auto_start: bool + :param monitoring_interval_in_seconds: Monitoring interval in seconds. + Default value: 60 . + :type monitoring_interval_in_seconds: int + """ + + _validation = { + 'source': {'required': True}, + 'destination': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'ConnectionMonitorSource'}, + 'destination': {'key': 'properties.destination', 'type': 'ConnectionMonitorDestination'}, + 'auto_start': {'key': 'properties.autoStart', 'type': 'bool'}, + 'monitoring_interval_in_seconds': {'key': 'properties.monitoringIntervalInSeconds', 'type': 'int'}, + } + + def __init__(self, source, destination, location=None, tags=None, auto_start=True, monitoring_interval_in_seconds=60): + super(ConnectionMonitor, self).__init__() + self.location = location + self.tags = tags + self.source = source + self.destination = destination + self.auto_start = auto_start + self.monitoring_interval_in_seconds = monitoring_interval_in_seconds diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_destination.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_destination.py new file mode 100644 index 000000000000..acaab3299666 --- /dev/null +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_destination.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ConnectionMonitorDestination(Model): + """Describes the destination of connection monitor. + + :param resource_id: The ID of the resource used as the destination by + connection monitor. + :type resource_id: str + :param address: Address of the connection monitor destination (IP or + domain name). + :type address: str + :param port: The destination port used by connection monitor. + :type port: int + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'address': {'key': 'address', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + } + + def __init__(self, resource_id=None, address=None, port=None): + super(ConnectionMonitorDestination, self).__init__() + self.resource_id = resource_id + self.address = address + self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_parameters.py new file mode 100644 index 000000000000..20abec6d8092 --- /dev/null +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_parameters.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ConnectionMonitorParameters(Model): + """Parameters that define the operation to create a connection monitor. + + :param source: + :type source: + ~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorSource + :param destination: + :type destination: + ~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorDestination + :param auto_start: Determines if the connection monitor will start + automatically once created. Default value: True . + :type auto_start: bool + :param monitoring_interval_in_seconds: Monitoring interval in seconds. + Default value: 60 . + :type monitoring_interval_in_seconds: int + """ + + _validation = { + 'source': {'required': True}, + 'destination': {'required': True}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'ConnectionMonitorSource'}, + 'destination': {'key': 'destination', 'type': 'ConnectionMonitorDestination'}, + 'auto_start': {'key': 'autoStart', 'type': 'bool'}, + 'monitoring_interval_in_seconds': {'key': 'monitoringIntervalInSeconds', 'type': 'int'}, + } + + def __init__(self, source, destination, auto_start=True, monitoring_interval_in_seconds=60): + super(ConnectionMonitorParameters, self).__init__() + self.source = source + self.destination = destination + self.auto_start = auto_start + self.monitoring_interval_in_seconds = monitoring_interval_in_seconds diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_query_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_query_result.py new file mode 100644 index 000000000000..a6a15d611cd8 --- /dev/null +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_query_result.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ConnectionMonitorQueryResult(Model): + """List of connection states snaphots. + + :param states: Information about connection states. + :type states: + list[~azure.mgmt.network.v2017_10_01.models.ConnectionStateSnapshot] + """ + + _attribute_map = { + 'states': {'key': 'states', 'type': '[ConnectionStateSnapshot]'}, + } + + def __init__(self, states=None): + super(ConnectionMonitorQueryResult, self).__init__() + self.states = states diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_result.py new file mode 100644 index 000000000000..dbce6bfe7ada --- /dev/null +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_result.py @@ -0,0 +1,96 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ConnectionMonitorResult(Model): + """Information about the connection monitor. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Name of the connection monitor. + :vartype name: str + :ivar id: ID of the connection monitor. + :vartype id: str + :param etag: Default value: "A unique read-only string that changes + whenever the resource is updated." . + :type etag: str + :ivar type: Connection monitor type. + :vartype type: str + :param location: Connection monitor location. + :type location: str + :param tags: Connection monitor tags. + :type tags: dict[str, str] + :param source: + :type source: + ~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorSource + :param destination: + :type destination: + ~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorDestination + :param auto_start: Determines if the connection monitor will start + automatically once created. Default value: True . + :type auto_start: bool + :param monitoring_interval_in_seconds: Monitoring interval in seconds. + Default value: 60 . + :type monitoring_interval_in_seconds: int + :param provisioning_state: The provisioning state of the connection + monitor. Possible values include: 'Succeeded', 'Updating', 'Deleting', + 'Failed' + :type provisioning_state: str or + ~azure.mgmt.network.v2017_10_01.models.ProvisioningState + :param start_time: The date and time when the connection monitor was + started. + :type start_time: datetime + :param monitoring_status: The monitoring status of the connection monitor. + :type monitoring_status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'source': {'required': True}, + 'destination': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'ConnectionMonitorSource'}, + 'destination': {'key': 'properties.destination', 'type': 'ConnectionMonitorDestination'}, + 'auto_start': {'key': 'properties.autoStart', 'type': 'bool'}, + 'monitoring_interval_in_seconds': {'key': 'properties.monitoringIntervalInSeconds', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, + 'monitoring_status': {'key': 'properties.monitoringStatus', 'type': 'str'}, + } + + def __init__(self, source, destination, etag="A unique read-only string that changes whenever the resource is updated.", location=None, tags=None, auto_start=True, monitoring_interval_in_seconds=60, provisioning_state=None, start_time=None, monitoring_status=None): + super(ConnectionMonitorResult, self).__init__() + self.name = None + self.id = None + self.etag = etag + self.type = None + self.location = location + self.tags = tags + self.source = source + self.destination = destination + self.auto_start = auto_start + self.monitoring_interval_in_seconds = monitoring_interval_in_seconds + self.provisioning_state = provisioning_state + self.start_time = start_time + self.monitoring_status = monitoring_status diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_result_paged.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_result_paged.py new file mode 100644 index 000000000000..038601d4d5a7 --- /dev/null +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_result_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ConnectionMonitorResultPaged(Paged): + """ + A paging container for iterating over a list of :class:`ConnectionMonitorResult ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ConnectionMonitorResult]'} + } + + def __init__(self, *args, **kwargs): + + super(ConnectionMonitorResultPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_source.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_source.py new file mode 100644 index 000000000000..c80aa3a2676d --- /dev/null +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_monitor_source.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ConnectionMonitorSource(Model): + """Describes the source of connection monitor. + + :param resource_id: The ID of the resource used as the source by + connection monitor. + :type resource_id: str + :param port: The source port used by connection monitor. + :type port: int + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + } + + def __init__(self, resource_id, port=None): + super(ConnectionMonitorSource, self).__init__() + self.resource_id = resource_id + self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_reset_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_reset_shared_key.py index 10bfdc9ba17d..3338112a7fe7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_reset_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_reset_shared_key.py @@ -29,4 +29,5 @@ class ConnectionResetSharedKey(Model): } def __init__(self, key_length): + super(ConnectionResetSharedKey, self).__init__() self.key_length = key_length diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_shared_key.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_shared_key.py index 0dbbc36cc798..2c1b0ed9a914 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_shared_key.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_shared_key.py @@ -28,4 +28,5 @@ class ConnectionSharedKey(Model): } def __init__(self, value): + super(ConnectionSharedKey, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_state_snapshot.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_state_snapshot.py new file mode 100644 index 000000000000..d5f6c321e9a9 --- /dev/null +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connection_state_snapshot.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ConnectionStateSnapshot(Model): + """Connection state snapshot. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param connection_state: The connection state. Possible values include: + 'Reachable', 'Unreachable', 'Unknown' + :type connection_state: str or + ~azure.mgmt.network.v2017_10_01.models.ConnectionState + :param start_time: The start time of the connection snapshot. + :type start_time: datetime + :param end_time: The end time of the connection snapshot. + :type end_time: datetime + :param evaluation_state: Connectivity analysis evaluation state. Possible + values include: 'NotStarted', 'InProgress', 'Completed' + :type evaluation_state: str or + ~azure.mgmt.network.v2017_10_01.models.EvaluationState + :ivar hops: List of hops between the source and the destination. + :vartype hops: + list[~azure.mgmt.network.v2017_10_01.models.ConnectivityHop] + """ + + _validation = { + 'hops': {'readonly': True}, + } + + _attribute_map = { + 'connection_state': {'key': 'connectionState', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'evaluation_state': {'key': 'evaluationState', 'type': 'str'}, + 'hops': {'key': 'hops', 'type': '[ConnectivityHop]'}, + } + + def __init__(self, connection_state=None, start_time=None, end_time=None, evaluation_state=None): + super(ConnectionStateSnapshot, self).__init__() + self.connection_state = connection_state + self.start_time = start_time + self.end_time = end_time + self.evaluation_state = evaluation_state + self.hops = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_destination.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_destination.py index 756dfadfdd49..cd0e8818b591 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_destination.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_destination.py @@ -32,6 +32,7 @@ class ConnectivityDestination(Model): } def __init__(self, resource_id=None, address=None, port=None): + super(ConnectivityDestination, self).__init__() self.resource_id = resource_id self.address = address self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_hop.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_hop.py index b23b217c858e..7ae7006531c3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_hop.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_hop.py @@ -52,6 +52,7 @@ class ConnectivityHop(Model): } def __init__(self): + super(ConnectivityHop, self).__init__() self.type = None self.id = None self.address = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_information.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_information.py index e2dd8a247da6..09caa9a5fd52 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_information.py @@ -58,6 +58,7 @@ class ConnectivityInformation(Model): } def __init__(self): + super(ConnectivityInformation, self).__init__() self.hops = None self.connection_status = None self.avg_latency_in_ms = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_issue.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_issue.py index 8804de5654ef..3ff451e35605 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_issue.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_issue.py @@ -48,6 +48,7 @@ class ConnectivityIssue(Model): } def __init__(self): + super(ConnectivityIssue, self).__init__() self.origin = None self.severity = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_parameters.py index b0d1ee3545db..c1cab3b4ea34 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_parameters.py @@ -33,5 +33,6 @@ class ConnectivityParameters(Model): } def __init__(self, source, destination): + super(ConnectivityParameters, self).__init__() self.source = source self.destination = destination diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_source.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_source.py index 8c7034e63c32..c42bfc0aa09d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_source.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/connectivity_source.py @@ -33,5 +33,6 @@ class ConnectivitySource(Model): } def __init__(self, resource_id, port=None): + super(ConnectivitySource, self).__init__() self.resource_id = resource_id self.port = port diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dhcp_options.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dhcp_options.py index 2262eb5ec2f1..8744ba6fc9b1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dhcp_options.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dhcp_options.py @@ -26,4 +26,5 @@ class DhcpOptions(Model): } def __init__(self, dns_servers=None): + super(DhcpOptions, self).__init__() self.dns_servers = dns_servers diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dimension.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dimension.py index 686a1e0570a6..f18204215221 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dimension.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dimension.py @@ -30,6 +30,7 @@ class Dimension(Model): } def __init__(self, name=None, display_name=None, internal_name=None): + super(Dimension, self).__init__() self.name = name self.display_name = display_name self.internal_name = internal_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dns_name_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dns_name_availability_result.py index 4be1851d2f59..15a0238e49a7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dns_name_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/dns_name_availability_result.py @@ -24,4 +24,5 @@ class DnsNameAvailabilityResult(Model): } def __init__(self, available=None): + super(DnsNameAvailabilityResult, self).__init__() self.available = available diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group.py index 80ed7f17ac9e..8cb4f05b9493 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group.py @@ -38,6 +38,7 @@ class EffectiveNetworkSecurityGroup(Model): } def __init__(self, network_security_group=None, association=None, effective_security_rules=None, tag_map=None): + super(EffectiveNetworkSecurityGroup, self).__init__() self.network_security_group = network_security_group self.association = association self.effective_security_rules = effective_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group_association.py index af22beb981c6..89d7dffdfe9c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group_association.py @@ -28,5 +28,6 @@ class EffectiveNetworkSecurityGroupAssociation(Model): } def __init__(self, subnet=None, network_interface=None): + super(EffectiveNetworkSecurityGroupAssociation, self).__init__() self.subnet = subnet self.network_interface = network_interface diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group_list_result.py index 4aec8cfcafe0..9f2f2b313cca 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_group_list_result.py @@ -35,5 +35,6 @@ class EffectiveNetworkSecurityGroupListResult(Model): } def __init__(self, value=None): + super(EffectiveNetworkSecurityGroupListResult, self).__init__() self.value = value self.next_link = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_rule.py index f7eee1116927..db0d917f2c70 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_rule.py @@ -83,6 +83,7 @@ class EffectiveNetworkSecurityRule(Model): } def __init__(self, name=None, protocol=None, source_port_range=None, destination_port_range=None, source_port_ranges=None, destination_port_ranges=None, source_address_prefix=None, destination_address_prefix=None, source_address_prefixes=None, destination_address_prefixes=None, expanded_source_address_prefix=None, expanded_destination_address_prefix=None, access=None, priority=None, direction=None): + super(EffectiveNetworkSecurityRule, self).__init__() self.name = name self.protocol = protocol self.source_port_range = source_port_range diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_route.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_route.py index 95c69d9efea4..2be46c9c4aec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_route.py @@ -51,6 +51,7 @@ class EffectiveRoute(Model): } def __init__(self, name=None, source=None, state=None, address_prefix=None, next_hop_ip_address=None, next_hop_type=None): + super(EffectiveRoute, self).__init__() self.name = name self.source = source self.state = state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_route_list_result.py index 8d1609f89bd6..03778f406106 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_route_list_result.py @@ -34,5 +34,6 @@ class EffectiveRouteListResult(Model): } def __init__(self, value=None): + super(EffectiveRouteListResult, self).__init__() self.value = value self.next_link = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/error.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/error.py index 2979eeb93c35..9ff1ae2f35d2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/error.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/error.py @@ -36,6 +36,7 @@ class Error(Model): } def __init__(self, code=None, message=None, target=None, details=None, inner_error=None): + super(Error, self).__init__() self.code = code self.message = message self.target = target diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/error_details.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/error_details.py index 47f2ac4111b1..40bea00aa2fb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/error_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/error_details.py @@ -30,6 +30,7 @@ class ErrorDetails(Model): } def __init__(self, code=None, target=None, message=None): + super(ErrorDetails, self).__init__() self.code = code self.target = target self.message = message diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_arp_table.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_arp_table.py index a2f8f716bf8a..ace325747ee5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_arp_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_arp_table.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitArpTable(Model): } def __init__(self, age=None, interface=None, ip_address=None, mac_address=None): + super(ExpressRouteCircuitArpTable, self).__init__() self.age = age self.interface = interface self.ip_address = ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_peering.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_peering.py index 6227df9be79d..fb1e847c5585 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_peering.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_peering.py @@ -33,7 +33,7 @@ class ExpressRouteCircuitPeering(SubResource): :param azure_asn: The Azure ASN. :type azure_asn: int :param peer_asn: The peer ASN. - :type peer_asn: int + :type peer_asn: long :param primary_peer_address_prefix: The primary address prefix. :type primary_peer_address_prefix: str :param secondary_peer_address_prefix: The secondary address prefix. @@ -74,6 +74,7 @@ class ExpressRouteCircuitPeering(SubResource): """ _validation = { + 'peer_asn': {'maximum': 4294967295, 'minimum': 1}, 'etag': {'readonly': True}, } @@ -82,7 +83,7 @@ class ExpressRouteCircuitPeering(SubResource): 'peering_type': {'key': 'properties.peeringType', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'azure_asn': {'key': 'properties.azureASN', 'type': 'int'}, - 'peer_asn': {'key': 'properties.peerASN', 'type': 'int'}, + 'peer_asn': {'key': 'properties.peerASN', 'type': 'long'}, 'primary_peer_address_prefix': {'key': 'properties.primaryPeerAddressPrefix', 'type': 'str'}, 'secondary_peer_address_prefix': {'key': 'properties.secondaryPeerAddressPrefix', 'type': 'str'}, 'primary_azure_port': {'key': 'properties.primaryAzurePort', 'type': 'str'}, diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_peering_config.py index e57e6e25e917..7dcc918be5cd 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_peering_config.py @@ -46,6 +46,7 @@ class ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, advertised_public_prefixes=None, advertised_communities=None, advertised_public_prefixes_state=None, legacy_mode=None, customer_asn=None, routing_registry_name=None): + super(ExpressRouteCircuitPeeringConfig, self).__init__() self.advertised_public_prefixes = advertised_public_prefixes self.advertised_communities = advertised_communities self.advertised_public_prefixes_state = advertised_public_prefixes_state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_routes_table.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_routes_table.py index e84fae6e0973..804d29a2f9bb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_routes_table.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_routes_table.py @@ -36,6 +36,7 @@ class ExpressRouteCircuitRoutesTable(Model): } def __init__(self, network=None, next_hop=None, loc_prf=None, weight=None, path=None): + super(ExpressRouteCircuitRoutesTable, self).__init__() self.network = network self.next_hop = next_hop self.loc_prf = loc_prf diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_routes_table_summary.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_routes_table_summary.py index 3ff1b42d0c1b..6f5f89764dd4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_routes_table_summary.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_routes_table_summary.py @@ -38,6 +38,7 @@ class ExpressRouteCircuitRoutesTableSummary(Model): } def __init__(self, neighbor=None, v=None, as_property=None, up_down=None, state_pfx_rcd=None): + super(ExpressRouteCircuitRoutesTableSummary, self).__init__() self.neighbor = neighbor self.v = v self.as_property = as_property diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_service_provider_properties.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_service_provider_properties.py index b7ada851e235..7a6b4ba96061 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_service_provider_properties.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_service_provider_properties.py @@ -30,6 +30,7 @@ class ExpressRouteCircuitServiceProviderProperties(Model): } def __init__(self, service_provider_name=None, peering_location=None, bandwidth_in_mbps=None): + super(ExpressRouteCircuitServiceProviderProperties, self).__init__() self.service_provider_name = service_provider_name self.peering_location = peering_location self.bandwidth_in_mbps = bandwidth_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_sku.py index d962009d292a..efacb32005b2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_sku.py @@ -34,6 +34,7 @@ class ExpressRouteCircuitSku(Model): } def __init__(self, name=None, tier=None, family=None): + super(ExpressRouteCircuitSku, self).__init__() self.name = name self.tier = tier self.family = family diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_stats.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_stats.py index 1215bda40383..e26f6f7d2f74 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_stats.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuit_stats.py @@ -33,6 +33,7 @@ class ExpressRouteCircuitStats(Model): } def __init__(self, primarybytes_in=None, primarybytes_out=None, secondarybytes_in=None, secondarybytes_out=None): + super(ExpressRouteCircuitStats, self).__init__() self.primarybytes_in = primarybytes_in self.primarybytes_out = primarybytes_out self.secondarybytes_in = secondarybytes_in diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_arp_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_arp_table_list_result.py index f0086e49164d..931aed56d4c4 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_arp_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_arp_table_list_result.py @@ -28,5 +28,6 @@ class ExpressRouteCircuitsArpTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsArpTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_routes_table_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_routes_table_list_result.py index 92183ea6c572..47d01cd41c19 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_routes_table_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_routes_table_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_routes_table_summary_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_routes_table_summary_list_result.py index 8c825a7d373f..732349f9e45c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_routes_table_summary_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_circuits_routes_table_summary_list_result.py @@ -29,5 +29,6 @@ class ExpressRouteCircuitsRoutesTableSummaryListResult(Model): } def __init__(self, value=None, next_link=None): + super(ExpressRouteCircuitsRoutesTableSummaryListResult, self).__init__() self.value = value self.next_link = next_link diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_service_provider_bandwidths_offered.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_service_provider_bandwidths_offered.py index b1b2c8a76447..9cbba2fcfe97 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_service_provider_bandwidths_offered.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/express_route_service_provider_bandwidths_offered.py @@ -27,5 +27,6 @@ class ExpressRouteServiceProviderBandwidthsOffered(Model): } def __init__(self, offer_name=None, value_in_mbps=None): + super(ExpressRouteServiceProviderBandwidthsOffered, self).__init__() self.offer_name = offer_name self.value_in_mbps = value_in_mbps diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/flow_log_information.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/flow_log_information.py index 912dc56baea2..e6d307338238 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/flow_log_information.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/flow_log_information.py @@ -42,6 +42,7 @@ class FlowLogInformation(Model): } def __init__(self, target_resource_id, storage_id, enabled, retention_policy=None): + super(FlowLogInformation, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/flow_log_status_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/flow_log_status_parameters.py index 1dae2ff24447..4cd22222bb45 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/flow_log_status_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/flow_log_status_parameters.py @@ -29,4 +29,5 @@ class FlowLogStatusParameters(Model): } def __init__(self, target_resource_id): + super(FlowLogStatusParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/gateway_route.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/gateway_route.py index d3e0d4163c35..64a53f146c0b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/gateway_route.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/gateway_route.py @@ -55,6 +55,7 @@ class GatewayRoute(Model): } def __init__(self): + super(GatewayRoute, self).__init__() self.local_address = None self.network = None self.next_hop = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/gateway_route_list_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/gateway_route_list_result.py index e2728bd77f5c..6da7f1ff2957 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/gateway_route_list_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/gateway_route_list_result.py @@ -24,4 +24,5 @@ class GatewayRouteListResult(Model): } def __init__(self, value=None): + super(GatewayRouteListResult, self).__init__() self.value = value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ip_address_availability_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ip_address_availability_result.py index 0e26dd91fffc..f2cb36a550ec 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ip_address_availability_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ip_address_availability_result.py @@ -28,5 +28,6 @@ class IPAddressAvailabilityResult(Model): } def __init__(self, available=None, available_ip_addresses=None): + super(IPAddressAvailabilityResult, self).__init__() self.available = available self.available_ip_addresses = available_ip_addresses diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ipsec_policy.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ipsec_policy.py index 7165cd434789..d339d9d22ccb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ipsec_policy.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ipsec_policy.py @@ -74,6 +74,7 @@ class IpsecPolicy(Model): } def __init__(self, sa_life_time_seconds, sa_data_size_kilobytes, ipsec_encryption, ipsec_integrity, ike_encryption, ike_integrity, dh_group, pfs_group): + super(IpsecPolicy, self).__init__() self.sa_life_time_seconds = sa_life_time_seconds self.sa_data_size_kilobytes = sa_data_size_kilobytes self.ipsec_encryption = ipsec_encryption diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ipv6_express_route_circuit_peering_config.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ipv6_express_route_circuit_peering_config.py index 8012b89f9d4f..b74e8080657e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ipv6_express_route_circuit_peering_config.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/ipv6_express_route_circuit_peering_config.py @@ -39,6 +39,7 @@ class Ipv6ExpressRouteCircuitPeeringConfig(Model): } def __init__(self, primary_peer_address_prefix=None, secondary_peer_address_prefix=None, microsoft_peering_config=None, route_filter=None, state=None): + super(Ipv6ExpressRouteCircuitPeeringConfig, self).__init__() self.primary_peer_address_prefix = primary_peer_address_prefix self.secondary_peer_address_prefix = secondary_peer_address_prefix self.microsoft_peering_config = microsoft_peering_config diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/load_balancer_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/load_balancer_sku.py index 6d86e06d7866..b74365daf396 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/load_balancer_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/load_balancer_sku.py @@ -26,4 +26,5 @@ class LoadBalancerSku(Model): } def __init__(self, name=None): + super(LoadBalancerSku, self).__init__() self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/log_specification.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/log_specification.py index cec1bbfcacb9..2386ea5f799f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/log_specification.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/log_specification.py @@ -30,6 +30,7 @@ class LogSpecification(Model): } def __init__(self, name=None, display_name=None, blob_duration=None): + super(LogSpecification, self).__init__() self.name = name self.display_name = display_name self.blob_duration = blob_duration diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/metric_specification.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/metric_specification.py index d89f1fafd4a0..a86668fcff8d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/metric_specification.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/metric_specification.py @@ -65,6 +65,7 @@ class MetricSpecification(Model): } def __init__(self, name=None, display_name=None, display_description=None, unit=None, aggregation_type=None, availabilities=None, enable_regional_mdm_account=None, fill_gap_with_zero=None, metric_filter_pattern=None, dimensions=None, is_internal=None, source_mdm_account=None, source_mdm_namespace=None, resource_id_dimension_name_override=None): + super(MetricSpecification, self).__init__() self.name = name self.display_name = display_name self.display_description = display_description diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_interface_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_interface_association.py index 00a32fe4b10a..bbe5bc114504 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_interface_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_interface_association.py @@ -35,5 +35,6 @@ class NetworkInterfaceAssociation(Model): } def __init__(self, security_rules=None): + super(NetworkInterfaceAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_interface_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_interface_dns_settings.py index 110594c2f928..675a4a1eb08a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_interface_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_interface_dns_settings.py @@ -47,6 +47,7 @@ class NetworkInterfaceDnsSettings(Model): } def __init__(self, dns_servers=None, applied_dns_servers=None, internal_dns_name_label=None, internal_fqdn=None, internal_domain_name_suffix=None): + super(NetworkInterfaceDnsSettings, self).__init__() self.dns_servers = dns_servers self.applied_dns_servers = applied_dns_servers self.internal_dns_name_label = internal_dns_name_label diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_management_client_enums.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_management_client_enums.py index efb1265d2875..abd139a2762c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_management_client_enums.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/network_management_client_enums.py @@ -373,6 +373,20 @@ class ConnectionStatus(Enum): degraded = "Degraded" +class ConnectionState(Enum): + + reachable = "Reachable" + unreachable = "Unreachable" + unknown = "Unknown" + + +class EvaluationState(Enum): + + not_started = "NotStarted" + in_progress = "InProgress" + completed = "Completed" + + class VirtualNetworkPeeringState(Enum): initiated = "Initiated" diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/next_hop_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/next_hop_parameters.py index f38a8ce62abb..3e1478409a0a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/next_hop_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/next_hop_parameters.py @@ -42,6 +42,7 @@ class NextHopParameters(Model): } def __init__(self, target_resource_id, source_ip_address, destination_ip_address, target_nic_resource_id=None): + super(NextHopParameters, self).__init__() self.target_resource_id = target_resource_id self.source_ip_address = source_ip_address self.destination_ip_address = destination_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/next_hop_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/next_hop_result.py index 4694e7b3e458..1d4e7908be5c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/next_hop_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/next_hop_result.py @@ -36,6 +36,7 @@ class NextHopResult(Model): } def __init__(self, next_hop_type=None, next_hop_ip_address=None, route_table_id=None): + super(NextHopResult, self).__init__() self.next_hop_type = next_hop_type self.next_hop_ip_address = next_hop_ip_address self.route_table_id = route_table_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation.py index 2526b3b59323..0d3a855708d5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation.py @@ -34,6 +34,7 @@ class Operation(Model): } def __init__(self, name=None, display=None, origin=None, service_specification=None): + super(Operation, self).__init__() self.name = name self.display = display self.origin = origin diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation_display.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation_display.py index 047521791265..91ea63defbf0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation_display.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation_display.py @@ -33,6 +33,7 @@ class OperationDisplay(Model): } def __init__(self, provider=None, resource=None, operation=None, description=None): + super(OperationDisplay, self).__init__() self.provider = provider self.resource = resource self.operation = operation diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation_properties_format_service_specification.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation_properties_format_service_specification.py index 8aee29df9834..9bb07d4788ff 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation_properties_format_service_specification.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/operation_properties_format_service_specification.py @@ -29,5 +29,6 @@ class OperationPropertiesFormatServiceSpecification(Model): } def __init__(self, metric_specifications=None, log_specifications=None): + super(OperationPropertiesFormatServiceSpecification, self).__init__() self.metric_specifications = metric_specifications self.log_specifications = log_specifications diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture.py index d85da14a1509..e61486a55bef 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture.py @@ -50,6 +50,7 @@ class PacketCapture(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCapture, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_filter.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_filter.py index 48abd9da8525..33436dc93310 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_filter.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_filter.py @@ -52,6 +52,7 @@ class PacketCaptureFilter(Model): } def __init__(self, protocol="Any", local_ip_address=None, remote_ip_address=None, local_port=None, remote_port=None): + super(PacketCaptureFilter, self).__init__() self.protocol = protocol self.local_ip_address = local_ip_address self.remote_ip_address = remote_ip_address diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_parameters.py index 8be824e43b85..5f556f54e795 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_parameters.py @@ -50,6 +50,7 @@ class PacketCaptureParameters(Model): } def __init__(self, target, storage_location, bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None): + super(PacketCaptureParameters, self).__init__() self.target = target self.bytes_to_capture_per_packet = bytes_to_capture_per_packet self.total_bytes_per_session = total_bytes_per_session diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_query_status_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_query_status_result.py index d9ac07391802..e2999e7ee958 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_query_status_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_query_status_result.py @@ -44,6 +44,7 @@ class PacketCaptureQueryStatusResult(Model): } def __init__(self, name=None, id=None, capture_start_time=None, packet_capture_status=None, stop_reason=None, packet_capture_error=None): + super(PacketCaptureQueryStatusResult, self).__init__() self.name = name self.id = id self.capture_start_time = capture_start_time diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_result.py index cb7608d4d5c8..d065ca709d38 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_result.py @@ -71,6 +71,7 @@ class PacketCaptureResult(Model): } def __init__(self, target, storage_location, etag="A unique read-only string that changes whenever the resource is updated.", bytes_to_capture_per_packet=0, total_bytes_per_session=1073741824, time_limit_in_seconds=18000, filters=None, provisioning_state=None): + super(PacketCaptureResult, self).__init__() self.name = None self.id = None self.etag = etag diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_storage_location.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_storage_location.py index d0987d11ff9f..773b04d22501 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_storage_location.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_storage_location.py @@ -36,6 +36,7 @@ class PacketCaptureStorageLocation(Model): } def __init__(self, storage_id=None, storage_path=None, file_path=None): + super(PacketCaptureStorageLocation, self).__init__() self.storage_id = storage_id self.storage_path = storage_path self.file_path = file_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/public_ip_address_dns_settings.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/public_ip_address_dns_settings.py index 65a534407848..a248461f05d7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/public_ip_address_dns_settings.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/public_ip_address_dns_settings.py @@ -39,6 +39,7 @@ class PublicIPAddressDnsSettings(Model): } def __init__(self, domain_name_label=None, fqdn=None, reverse_fqdn=None): + super(PublicIPAddressDnsSettings, self).__init__() self.domain_name_label = domain_name_label self.fqdn = fqdn self.reverse_fqdn = reverse_fqdn diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/public_ip_address_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/public_ip_address_sku.py index 58c76647c7b5..0adb0b21dcf3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/public_ip_address_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/public_ip_address_sku.py @@ -26,4 +26,5 @@ class PublicIPAddressSku(Model): } def __init__(self, name=None): + super(PublicIPAddressSku, self).__init__() self.name = name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/query_troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/query_troubleshooting_parameters.py index a394b181fcc5..9b6801eb7b63 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/query_troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/query_troubleshooting_parameters.py @@ -29,4 +29,5 @@ class QueryTroubleshootingParameters(Model): } def __init__(self, target_resource_id): + super(QueryTroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/resource.py index ef9699426827..ff5f1f40e14e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/resource.py @@ -44,6 +44,7 @@ class Resource(Model): } def __init__(self, id=None, location=None, tags=None): + super(Resource, self).__init__() self.id = id self.name = None self.type = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/retention_policy_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/retention_policy_parameters.py index 58f7f12cc6a9..102f4c5c3b4c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/retention_policy_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/retention_policy_parameters.py @@ -27,5 +27,6 @@ class RetentionPolicyParameters(Model): } def __init__(self, days=0, enabled=False): + super(RetentionPolicyParameters, self).__init__() self.days = days self.enabled = enabled diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_network_interface.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_network_interface.py index b29d6ec3ea71..e82029b238c1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_network_interface.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_network_interface.py @@ -28,5 +28,6 @@ class SecurityGroupNetworkInterface(Model): } def __init__(self, id=None, security_rule_associations=None): + super(SecurityGroupNetworkInterface, self).__init__() self.id = id self.security_rule_associations = security_rule_associations diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_view_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_view_parameters.py index 304908dd4792..5c0972e5d55e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_view_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_view_parameters.py @@ -28,4 +28,5 @@ class SecurityGroupViewParameters(Model): } def __init__(self, target_resource_id): + super(SecurityGroupViewParameters, self).__init__() self.target_resource_id = target_resource_id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_view_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_view_result.py index 818721d0b9bd..cc51a5445369 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_view_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_group_view_result.py @@ -25,4 +25,5 @@ class SecurityGroupViewResult(Model): } def __init__(self, network_interfaces=None): + super(SecurityGroupViewResult, self).__init__() self.network_interfaces = network_interfaces diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_rule.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_rule.py index c2f1f923a436..1752fa042608 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_rule.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_rule.py @@ -111,7 +111,7 @@ class SecurityRule(SubResource): 'etag': {'key': 'etag', 'type': 'str'}, } - def __init__(self, protocol, source_address_prefix=None, destination_address_prefix=None, access=None, direction=None, id=None, description=None, source_port_range=None, destination_port_range=None, source_address_prefixes=None, source_application_security_groups=None, destination_address_prefixes=None, destination_application_security_groups=None, source_port_ranges=None, destination_port_ranges=None, priority=None, provisioning_state=None, name=None, etag=None): + def __init__(self, protocol, access, direction, id=None, description=None, source_port_range=None, destination_port_range=None, source_address_prefix=None, source_address_prefixes=None, source_application_security_groups=None, destination_address_prefix=None, destination_address_prefixes=None, destination_application_security_groups=None, source_port_ranges=None, destination_port_ranges=None, priority=None, provisioning_state=None, name=None, etag=None): super(SecurityRule, self).__init__(id=id) self.description = description self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_rule_associations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_rule_associations.py index 557214837e1b..72c3217ea4c7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_rule_associations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_rule_associations.py @@ -38,6 +38,7 @@ class SecurityRuleAssociations(Model): } def __init__(self, network_interface_association=None, subnet_association=None, default_security_rules=None, effective_security_rules=None): + super(SecurityRuleAssociations, self).__init__() self.network_interface_association = network_interface_association self.subnet_association = subnet_association self.default_security_rules = default_security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/service_endpoint_properties_format.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/service_endpoint_properties_format.py index 0168d03284a9..847cb9ac8b3b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/service_endpoint_properties_format.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/service_endpoint_properties_format.py @@ -30,6 +30,7 @@ class ServiceEndpointPropertiesFormat(Model): } def __init__(self, service=None, locations=None, provisioning_state=None): + super(ServiceEndpointPropertiesFormat, self).__init__() self.service = service self.locations = locations self.provisioning_state = provisioning_state diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/sub_resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/sub_resource.py index b23dc42afd0e..491f1d1caf83 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/sub_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/sub_resource.py @@ -24,4 +24,5 @@ class SubResource(Model): } def __init__(self, id=None): + super(SubResource, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/subnet_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/subnet_association.py index ba06e29a486c..6eaa391d31e6 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/subnet_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/subnet_association.py @@ -35,5 +35,6 @@ class SubnetAssociation(Model): } def __init__(self, security_rules=None): + super(SubnetAssociation, self).__init__() self.id = None self.security_rules = security_rules diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/tags_object.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/tags_object.py index db3796de9bdc..539129368be9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/tags_object.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/tags_object.py @@ -24,4 +24,5 @@ class TagsObject(Model): } def __init__(self, tags=None): + super(TagsObject, self).__init__() self.tags = tags diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology.py index d79fd9ff1258..27e00ea286e0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology.py @@ -44,6 +44,7 @@ class Topology(Model): } def __init__(self, resources=None): + super(Topology, self).__init__() self.id = None self.created_date_time = None self.last_modified = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_association.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_association.py index be0955a8ed70..ed5dd30a5b95 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_association.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_association.py @@ -34,6 +34,7 @@ class TopologyAssociation(Model): } def __init__(self, name=None, resource_id=None, association_type=None): + super(TopologyAssociation, self).__init__() self.name = name self.resource_id = resource_id self.association_type = association_type diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_parameters.py index c2f674cad7fc..f53c2533dae5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_parameters.py @@ -18,15 +18,22 @@ class TopologyParameters(Model): :param target_resource_group_name: The name of the target resource group to perform topology on. :type target_resource_group_name: str + :param target_virtual_network: The reference of the Virtual Network + resource. + :type target_virtual_network: + ~azure.mgmt.network.v2017_10_01.models.SubResource + :param target_subnet: The reference of the Subnet resource. + :type target_subnet: ~azure.mgmt.network.v2017_10_01.models.SubResource """ - _validation = { - 'target_resource_group_name': {'required': True}, - } - _attribute_map = { 'target_resource_group_name': {'key': 'targetResourceGroupName', 'type': 'str'}, + 'target_virtual_network': {'key': 'targetVirtualNetwork', 'type': 'SubResource'}, + 'target_subnet': {'key': 'targetSubnet', 'type': 'SubResource'}, } - def __init__(self, target_resource_group_name): + def __init__(self, target_resource_group_name=None, target_virtual_network=None, target_subnet=None): + super(TopologyParameters, self).__init__() self.target_resource_group_name = target_resource_group_name + self.target_virtual_network = target_virtual_network + self.target_subnet = target_subnet diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_resource.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_resource.py index 0687ff27079d..1888f92be224 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_resource.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/topology_resource.py @@ -35,6 +35,7 @@ class TopologyResource(Model): } def __init__(self, name=None, id=None, location=None, associations=None): + super(TopologyResource, self).__init__() self.name = name self.id = id self.location = location diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_details.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_details.py index 2d844bd1fcdc..5acc197c3012 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_details.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_details.py @@ -37,6 +37,7 @@ class TroubleshootingDetails(Model): } def __init__(self, id=None, reason_type=None, summary=None, detail=None, recommended_actions=None): + super(TroubleshootingDetails, self).__init__() self.id = id self.reason_type = reason_type self.summary = summary diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_parameters.py index d6bd7ebe04e6..c4833fb8eeb3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_parameters.py @@ -38,6 +38,7 @@ class TroubleshootingParameters(Model): } def __init__(self, target_resource_id, storage_id, storage_path): + super(TroubleshootingParameters, self).__init__() self.target_resource_id = target_resource_id self.storage_id = storage_id self.storage_path = storage_path diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_recommended_actions.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_recommended_actions.py index 479eb32b8fa8..cbc5e31177c7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_recommended_actions.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_recommended_actions.py @@ -35,6 +35,7 @@ class TroubleshootingRecommendedActions(Model): } def __init__(self, action_id=None, action_text=None, action_uri=None, action_uri_text=None): + super(TroubleshootingRecommendedActions, self).__init__() self.action_id = action_id self.action_text = action_text self.action_uri = action_uri diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_result.py index d8bde65a5e2a..bce20980a2c0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/troubleshooting_result.py @@ -34,6 +34,7 @@ class TroubleshootingResult(Model): } def __init__(self, start_time=None, end_time=None, code=None, results=None): + super(TroubleshootingResult, self).__init__() self.start_time = start_time self.end_time = end_time self.code = code diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/tunnel_connection_health.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/tunnel_connection_health.py index ec8322455c30..231b3ef25648 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/tunnel_connection_health.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/tunnel_connection_health.py @@ -53,6 +53,7 @@ class TunnelConnectionHealth(Model): } def __init__(self): + super(TunnelConnectionHealth, self).__init__() self.tunnel = None self.connection_status = None self.ingress_bytes_transferred = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/usage.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/usage.py index b10a32193b19..62f58c028e7b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/usage.py @@ -50,6 +50,7 @@ class Usage(Model): unit = "Count" def __init__(self, current_value, limit, name): + super(Usage, self).__init__() self.id = None self.current_value = current_value self.limit = limit diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/usage_name.py index 87786b60cf62..df7f344bfb9b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/usage_name.py @@ -27,5 +27,6 @@ class UsageName(Model): } def __init__(self, value=None, localized_value=None): + super(UsageName, self).__init__() self.value = value self.localized_value = localized_value diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/verification_ip_flow_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/verification_ip_flow_parameters.py index 53c4935d5852..8bfff5e60bc3 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/verification_ip_flow_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/verification_ip_flow_parameters.py @@ -66,6 +66,7 @@ class VerificationIPFlowParameters(Model): } def __init__(self, target_resource_id, direction, protocol, local_port, remote_port, local_ip_address, remote_ip_address, target_nic_resource_id=None): + super(VerificationIPFlowParameters, self).__init__() self.target_resource_id = target_resource_id self.direction = direction self.protocol = protocol diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/verification_ip_flow_result.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/verification_ip_flow_result.py index 20b296e08a50..cf8f232996bf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/verification_ip_flow_result.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/verification_ip_flow_result.py @@ -29,5 +29,6 @@ class VerificationIPFlowResult(Model): } def __init__(self, access=None, rule_name=None): + super(VerificationIPFlowResult, self).__init__() self.access = access self.rule_name = rule_name diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_connection_gateway_reference.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_connection_gateway_reference.py index f50295906ad8..eb18a3c124ff 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_connection_gateway_reference.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_connection_gateway_reference.py @@ -29,4 +29,5 @@ class VirtualNetworkConnectionGatewayReference(Model): } def __init__(self, id): + super(VirtualNetworkConnectionGatewayReference, self).__init__() self.id = id diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_gateway_sku.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_gateway_sku.py index 92ced59b3c60..1453a8b42ea7 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_gateway_sku.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_gateway_sku.py @@ -36,6 +36,7 @@ class VirtualNetworkGatewaySku(Model): } def __init__(self, name=None, tier=None, capacity=None): + super(VirtualNetworkGatewaySku, self).__init__() self.name = name self.tier = tier self.capacity = capacity diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_usage.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_usage.py index 924e012de075..e5c7ddae9772 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_usage.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_usage.py @@ -48,6 +48,7 @@ class VirtualNetworkUsage(Model): } def __init__(self): + super(VirtualNetworkUsage, self).__init__() self.current_value = None self.id = None self.limit = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_usage_name.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_usage_name.py index dd93c0846a5c..01fcbf0875eb 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_usage_name.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/virtual_network_usage_name.py @@ -35,5 +35,6 @@ class VirtualNetworkUsageName(Model): } def __init__(self): + super(VirtualNetworkUsageName, self).__init__() self.localized_value = None self.value = None diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_client_configuration.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_client_configuration.py index 2b7bc8826f0b..411b97cdca03 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_client_configuration.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_client_configuration.py @@ -49,6 +49,7 @@ class VpnClientConfiguration(Model): } def __init__(self, vpn_client_address_pool=None, vpn_client_root_certificates=None, vpn_client_revoked_certificates=None, vpn_client_protocols=None, radius_server_address=None, radius_server_secret=None): + super(VpnClientConfiguration, self).__init__() self.vpn_client_address_pool = vpn_client_address_pool self.vpn_client_root_certificates = vpn_client_root_certificates self.vpn_client_revoked_certificates = vpn_client_revoked_certificates diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_client_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_client_parameters.py index 86d52d822644..b9dcce414315 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_client_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_client_parameters.py @@ -43,6 +43,7 @@ class VpnClientParameters(Model): } def __init__(self, processor_architecture=None, authentication_method=None, radius_server_auth_certificate=None, client_root_certificates=None): + super(VpnClientParameters, self).__init__() self.processor_architecture = processor_architecture self.authentication_method = authentication_method self.radius_server_auth_certificate = radius_server_auth_certificate diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_device_script_parameters.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_device_script_parameters.py index f7741841de06..89ee8af0645a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_device_script_parameters.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/vpn_device_script_parameters.py @@ -30,6 +30,7 @@ class VpnDeviceScriptParameters(Model): } def __init__(self, vendor=None, device_family=None, firmware_version=None): + super(VpnDeviceScriptParameters, self).__init__() self.vendor = vendor self.device_family = device_family self.firmware_version = firmware_version diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/network_management_client.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/network_management_client.py index 2c6133555e97..9889c016210d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/network_management_client.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/network_management_client.py @@ -39,6 +39,7 @@ from .operations.default_security_rules_operations import DefaultSecurityRulesOperations from .operations.network_watchers_operations import NetworkWatchersOperations from .operations.packet_captures_operations import PacketCapturesOperations +from .operations.connection_monitors_operations import ConnectionMonitorsOperations from .operations.operations import Operations from .operations.public_ip_addresses_operations import PublicIPAddressesOperations from .operations.route_filters_operations import RouteFiltersOperations @@ -140,6 +141,8 @@ class NetworkManagementClient(object): :vartype network_watchers: azure.mgmt.network.v2017_10_01.operations.NetworkWatchersOperations :ivar packet_captures: PacketCaptures operations :vartype packet_captures: azure.mgmt.network.v2017_10_01.operations.PacketCapturesOperations + :ivar connection_monitors: ConnectionMonitors operations + :vartype connection_monitors: azure.mgmt.network.v2017_10_01.operations.ConnectionMonitorsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.network.v2017_10_01.operations.Operations :ivar public_ip_addresses: PublicIPAddresses operations @@ -233,6 +236,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.packet_captures = PacketCapturesOperations( self._client, self.config, self._serialize, self._deserialize) + self.connection_monitors = ConnectionMonitorsOperations( + self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) self.public_ip_addresses = PublicIPAddressesOperations( @@ -311,7 +316,7 @@ def check_dns_name_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/__init__.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/__init__.py index 7f37d404c590..eeaf47139863 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/__init__.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/__init__.py @@ -31,6 +31,7 @@ from .default_security_rules_operations import DefaultSecurityRulesOperations from .network_watchers_operations import NetworkWatchersOperations from .packet_captures_operations import PacketCapturesOperations +from .connection_monitors_operations import ConnectionMonitorsOperations from .operations import Operations from .public_ip_addresses_operations import PublicIPAddressesOperations from .route_filters_operations import RouteFiltersOperations @@ -69,6 +70,7 @@ 'DefaultSecurityRulesOperations', 'NetworkWatchersOperations', 'PacketCapturesOperations', + 'ConnectionMonitorsOperations', 'Operations', 'PublicIPAddressesOperations', 'RouteFiltersOperations', diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/application_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/application_gateways_operations.py index 14fd6b14be32..4bf21dd3440c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/application_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/application_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param parameters: Parameters supplied to the create or update - application gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.ApplicationGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ApplicationGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ApplicationGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, application_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param parameters: Parameters supplied to the create or update + application gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.ApplicationGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ApplicationGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('ApplicationGateway', response) + deserialized = self._deserialize('ApplicationGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -269,26 +319,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, application_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates the specified application gateway tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ApplicationGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, application_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -318,19 +351,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, application_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates the specified application gateway tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ApplicationGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -339,10 +423,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGateway', response) + deserialized = self._deserialize('ApplicationGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -350,10 +431,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -409,7 +486,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -473,7 +550,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -492,23 +569,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def start( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Starts the specified application gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _start_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start' path_format_arguments = { @@ -533,18 +596,58 @@ def start( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 start( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Starts the specified application gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._start_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -557,10 +660,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -568,23 +667,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): - """Stops the specified application gateway in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop' path_format_arguments = { @@ -609,18 +694,58 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 stop( + self, resource_group_name, application_gateway_name, custom_headers=None, raw=False, **operation_config): + """Stops the specified application gateway in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -633,10 +758,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -644,28 +765,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def backend_health( - self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Gets the backend health of the specified application gateway in a - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_gateway_name: The name of the application gateway. - :type application_gateway_name: str - :param expand: Expands BackendAddressPool and BackendHttpSettings - referenced in backend health. - :type expand: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationGatewayBackendHealth or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ApplicationGatewayBackendHealth] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _backend_health_initial( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth' path_format_arguments = { @@ -692,18 +794,71 @@ def backend_health( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('ApplicationGatewayBackendHealth', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def backend_health( + self, resource_group_name, application_gateway_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets the backend health of the specified application gateway in a + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_gateway_name: The name of the application gateway. + :type application_gateway_name: str + :param expand: Expands BackendAddressPool and BackendHttpSettings + referenced in backend health. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationGatewayBackendHealth or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ApplicationGatewayBackendHealth] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._backend_health_initial( + resource_group_name=resource_group_name, + application_gateway_name=application_gateway_name, + expand=expand, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -712,10 +867,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) + deserialized = self._deserialize('ApplicationGatewayBackendHealth', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -723,10 +875,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -773,7 +921,7 @@ def list_available_waf_rule_sets( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -830,7 +978,7 @@ def list_available_ssl_options( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -894,7 +1042,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -955,7 +1103,7 @@ def get_ssl_predefined_policy( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/application_security_groups_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/application_security_groups_operations.py index 9754a2222543..8c91aad676a1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/application_security_groups_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/application_security_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,24 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, application_security_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified application security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_security_group_name: The name of the application - security group. - :type application_security_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, application_security_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}' path_format_arguments = { @@ -80,18 +66,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, application_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified application security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_security_group_name: The name of the application + security group. + :type application_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -104,10 +131,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -160,7 +183,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -178,29 +201,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, application_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an application security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param application_security_group_name: The name of the application - security group. - :type application_security_group_name: str - :param parameters: Parameters supplied to the create or update - ApplicationSecurityGroup operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.ApplicationSecurityGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ApplicationSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ApplicationSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, application_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}' path_format_arguments = { @@ -228,19 +231,75 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ApplicationSecurityGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, application_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an application security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param application_security_group_name: The name of the application + security group. + :type application_security_group_name: str + :param parameters: Parameters supplied to the create or update + ApplicationSecurityGroup operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.ApplicationSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ApplicationSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ApplicationSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + application_security_group_name=application_security_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ApplicationSecurityGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('ApplicationSecurityGroup', response) + deserialized = self._deserialize('ApplicationSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -318,7 +368,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -385,7 +435,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/available_endpoint_services_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/available_endpoint_services_operations.py index 4b75e70cf49e..86119b6e5708 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/available_endpoint_services_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/available_endpoint_services_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/bgp_service_communities_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/bgp_service_communities_operations.py index a236241f4623..d9c5d661b0bf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/bgp_service_communities_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/bgp_service_communities_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/connection_monitors_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/connection_monitors_operations.py new file mode 100644 index 000000000000..e8eda770e939 --- /dev/null +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/connection_monitors_operations.py @@ -0,0 +1,729 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError +from msrestazure.azure_operation import AzureOperationPoller + +from .. import models + + +class ConnectionMonitorsOperations(object): + """ConnectionMonitorsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Client API version. Constant value: "2017-10-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-10-01" + + self.config = config + + + def _create_or_update_initial( + self, resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_name, 'str'), + 'connectionMonitorName': self._serialize.url("connection_monitor_name", connection_monitor_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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ConnectionMonitor') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConnectionMonitorResult', response) + if response.status_code == 201: + deserialized = self._deserialize('ConnectionMonitorResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or update a connection monitor. + + :param resource_group_name: The name of the resource group containing + Network Watcher. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. + :type connection_monitor_name: str + :param parameters: Parameters that define the operation to create a + connection monitor. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.ConnectionMonitor + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionMonitorResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = self._deserialize('ConnectionMonitorResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def get( + self, resource_group_name, network_watcher_name, connection_monitor_name, custom_headers=None, raw=False, **operation_config): + """Gets a connection monitor by name. + + :param resource_group_name: The name of the resource group containing + Network Watcher. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. + :type connection_monitor_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ConnectionMonitorResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_name, 'str'), + 'connectionMonitorName': self._serialize.url("connection_monitor_name", connection_monitor_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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConnectionMonitorResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + + def _delete_initial( + self, resource_group_name, network_watcher_name, connection_monitor_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_name, 'str'), + 'connectionMonitorName': self._serialize.url("connection_monitor_name", connection_monitor_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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, connection_monitor_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified connection monitor. + + :param resource_group_name: The name of the resource group containing + Network Watcher. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. + :type connection_monitor_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + + def _stop_initial( + self, resource_group_name, network_watcher_name, connection_monitor_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_name, 'str'), + 'connectionMonitorName': self._serialize.url("connection_monitor_name", connection_monitor_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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 stop( + self, resource_group_name, network_watcher_name, connection_monitor_name, custom_headers=None, raw=False, **operation_config): + """Stops the specified connection monitor. + + :param resource_group_name: The name of the resource group containing + Network Watcher. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. + :type connection_monitor_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + 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 + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + + def _start_initial( + self, resource_group_name, network_watcher_name, connection_monitor_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_name, 'str'), + 'connectionMonitorName': self._serialize.url("connection_monitor_name", connection_monitor_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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 start( + self, resource_group_name, network_watcher_name, connection_monitor_name, custom_headers=None, raw=False, **operation_config): + """Starts the specified connection monitor. + + :param resource_group_name: The name of the resource group containing + Network Watcher. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param connection_monitor_name: The name of the connection monitor. + :type connection_monitor_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._start_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + 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 + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + + def _query_initial( + self, resource_group_name, network_watcher_name, connection_monitor_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_name, 'str'), + 'connectionMonitorName': self._serialize.url("connection_monitor_name", connection_monitor_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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ConnectionMonitorQueryResult', response) + if response.status_code == 202: + deserialized = self._deserialize('ConnectionMonitorQueryResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def query( + self, resource_group_name, network_watcher_name, connection_monitor_name, custom_headers=None, raw=False, **operation_config): + """Query a snapshot of the most recent connection states. + + :param resource_group_name: The name of the resource group containing + Network Watcher. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param connection_monitor_name: The name given to the connection + monitor. + :type connection_monitor_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionMonitorQueryResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorQueryResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._query_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + connection_monitor_name=connection_monitor_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = self._deserialize('ConnectionMonitorQueryResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def list( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): + """Lists all connection monitors for the specified Network Watcher. + + :param resource_group_name: The name of the resource group containing + Network Watcher. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ConnectionMonitorResult + :rtype: + ~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorResultPaged[~azure.mgmt.network.v2017_10_01.models.ConnectionMonitorResult] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_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("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ConnectionMonitorResultPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ConnectionMonitorResultPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/default_security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/default_security_rules_operations.py index 39015ef199d0..516484df1219 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/default_security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/default_security_rules_operations.py @@ -89,7 +89,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -156,7 +156,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuit_authorizations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuit_authorizations_operations.py index b50345058ab5..050dae6c822b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuit_authorizations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuit_authorizations_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified authorization from the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, authorization_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified authorization from the specified express route + circuit. - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,31 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an authorization in the specified express route - circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param authorization_name: The name of the authorization. - :type authorization_name: str - :param authorization_parameters: Parameters supplied to the create or - update express route circuit authorization operation. - :type authorization_parameters: - ~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitAuthorization - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitAuthorization] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}' path_format_arguments = { @@ -238,19 +240,78 @@ def create_or_update( body_content = self._serialize.body(authorization_parameters, 'ExpressRouteCircuitAuthorization') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an authorization in the specified express route + circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param authorization_name: The name of the authorization. + :type authorization_name: str + :param authorization_parameters: Parameters supplied to the create or + update express route circuit authorization operation. + :type authorization_parameters: + ~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitAuthorization + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitAuthorization or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitAuthorization] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + authorization_name=authorization_name, + authorization_parameters=authorization_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -259,12 +320,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) + deserialized = self._deserialize('ExpressRouteCircuitAuthorization', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -272,10 +328,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuit_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuit_peerings_operations.py index 470a5a2c4b2f..b68ae36c5a3e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuit_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuit_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified peering from the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, circuit_name, peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified peering from the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified express route circuits. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param peering_parameters: Parameters supplied to the create or update - express route circuit peering operation. - :type peering_parameters: - ~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(peering_parameters, 'ExpressRouteCircuitPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified express route circuits. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param peering_parameters: Parameters supplied to the create or update + express route circuit peering operation. + :type peering_parameters: + ~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + peering_parameters=peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuitPeering', response) + deserialized = self._deserialize('ExpressRouteCircuitPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuits_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuits_operations.py index dc11e10fd1f4..9691ef4edea2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuits_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuits_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def delete( + self, resource_group_name, circuit_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -157,7 +180,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -175,28 +198,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an express route circuit. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the circuit. - :type circuit_name: str - :param parameters: Parameters supplied to the create or update express - route circuit operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuit - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuit or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuit] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}' path_format_arguments = { @@ -224,19 +228,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ExpressRouteCircuit') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuit', response) + if response.status_code == 201: + deserialized = self._deserialize('ExpressRouteCircuit', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, circuit_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an express route circuit. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the circuit. + :type circuit_name: str + :param parameters: Parameters supplied to the create or update express + route circuit operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuit + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuit or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuit] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -245,12 +304,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuit', response) - if response.status_code == 201: - deserialized = self._deserialize('ExpressRouteCircuit', response) + deserialized = self._deserialize('ExpressRouteCircuit', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +312,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -269,26 +319,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, circuit_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates an express route circuit tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the circuit. - :type circuit_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuit or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuit] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, circuit_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -318,19 +351,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ExpressRouteCircuit', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, circuit_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates an express route circuit tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the circuit. + :type circuit_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuit or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuit] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -339,10 +423,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuit', response) + deserialized = self._deserialize('ExpressRouteCircuit', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -350,10 +431,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -361,30 +438,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_arp_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised ARP table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsArpTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitsArpTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_arp_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}' path_format_arguments = { @@ -411,18 +467,74 @@ def list_arp_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsArpTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_arp_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised ARP table associated with the express + route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsArpTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitsArpTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_arp_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -431,10 +543,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsArpTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -442,10 +551,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -453,30 +558,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table associated with the express - route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitsRoutesTableListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}' path_format_arguments = { @@ -503,18 +587,74 @@ def list_routes_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsRoutesTableListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table associated with the express + route circuit in a resource group. - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitsRoutesTableListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -523,10 +663,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -534,10 +671,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -545,30 +678,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_routes_table_summary( - self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): - """Gets the currently advertised routes table summary associated with the - express route circuit in a resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param circuit_name: The name of the express route circuit. - :type circuit_name: str - :param peering_name: The name of the peering. - :type peering_name: str - :param device_path: The path of the device. - :type device_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse - if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_routes_table_summary_initial( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}' path_format_arguments = { @@ -595,18 +707,74 @@ def list_routes_table_summary( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_routes_table_summary( + self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, **operation_config): + """Gets the currently advertised routes table summary associated with the + express route circuit in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param circuit_name: The name of the express route circuit. + :type circuit_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param device_path: The path of the device. + :type device_path: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ExpressRouteCircuitsRoutesTableSummaryListResult or ClientRawResponse + if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitsRoutesTableSummaryListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_routes_table_summary_initial( + resource_group_name=resource_group_name, + circuit_name=circuit_name, + peering_name=peering_name, + device_path=device_path, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -615,10 +783,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) + deserialized = self._deserialize('ExpressRouteCircuitsRoutesTableSummaryListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -626,10 +791,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -681,7 +842,7 @@ def get_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -746,7 +907,7 @@ def get_peering_stats( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -812,7 +973,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -876,7 +1037,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_service_providers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_service_providers_operations.py index 51f54d1cb12d..f06592bd20a2 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_service_providers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_service_providers_operations.py @@ -82,7 +82,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/inbound_nat_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/inbound_nat_rules_operations.py index 1fee7935c423..f4c41b820ffa 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/inbound_nat_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/inbound_nat_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -108,25 +109,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def delete( - self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer inbound nat rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param inbound_nat_rule_name: The name of the inbound nat rule. - :type inbound_nat_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}' path_format_arguments = { @@ -152,18 +137,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer inbound nat rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound nat rule. + :type inbound_nat_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -176,10 +204,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -237,7 +261,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -255,30 +279,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer inbound nat rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param inbound_nat_rule_name: The name of the inbound nat rule. - :type inbound_nat_rule_name: str - :param inbound_nat_rule_parameters: Parameters supplied to the create - or update inbound nat rule operation. - :type inbound_nat_rule_parameters: - ~azure.mgmt.network.v2017_10_01.models.InboundNatRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - InboundNatRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.InboundNatRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}' path_format_arguments = { @@ -307,19 +310,77 @@ def create_or_update( body_content = self._serialize.body(inbound_nat_rule_parameters, 'InboundNatRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('InboundNatRule', response) + if response.status_code == 201: + deserialized = self._deserialize('InboundNatRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer inbound nat rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param inbound_nat_rule_name: The name of the inbound nat rule. + :type inbound_nat_rule_name: str + :param inbound_nat_rule_parameters: Parameters supplied to the create + or update inbound nat rule operation. + :type inbound_nat_rule_parameters: + ~azure.mgmt.network.v2017_10_01.models.InboundNatRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + InboundNatRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.InboundNatRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + inbound_nat_rule_name=inbound_nat_rule_name, + inbound_nat_rule_parameters=inbound_nat_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -328,12 +389,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('InboundNatRule', response) - if response.status_code == 201: - deserialized = self._deserialize('InboundNatRule', response) + deserialized = self._deserialize('InboundNatRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -341,10 +397,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_backend_address_pools_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_backend_address_pools_operations.py index c1e55ad57686..9b202c8b6353 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_backend_address_pools_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_backend_address_pools_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -154,7 +154,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_frontend_ip_configurations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_frontend_ip_configurations_operations.py index 7ec9e3ab59e0..f08b09b681e1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_frontend_ip_configurations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_frontend_ip_configurations_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -154,7 +154,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_load_balancing_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_load_balancing_rules_operations.py index 8df9c6cc436c..cb5eb74dc12e 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_load_balancing_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_load_balancing_rules_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -153,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_network_interfaces_operations.py index a1dc45c8d89b..58e7f756c78a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_network_interfaces_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_probes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_probes_operations.py index de9b4e7b7a2c..b6816d84e9af 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_probes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancer_probes_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -153,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancers_operations.py index 67596acca764..cf94d2a21a40 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/load_balancers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, load_balancer_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a load balancer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param parameters: Parameters supplied to the create or update load - balancer operation. - :type parameters: ~azure.mgmt.network.v2017_10_01.models.LoadBalancer - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns LoadBalancer - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.LoadBalancer] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LoadBalancer') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LoadBalancer', response) + if response.status_code == 201: + deserialized = self._deserialize('LoadBalancer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, load_balancer_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a load balancer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param parameters: Parameters supplied to the create or update load + balancer operation. + :type parameters: ~azure.mgmt.network.v2017_10_01.models.LoadBalancer + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns LoadBalancer + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.LoadBalancer] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LoadBalancer', response) - if response.status_code == 201: - deserialized = self._deserialize('LoadBalancer', response) + deserialized = self._deserialize('LoadBalancer', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -272,26 +322,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, load_balancer_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a load balancer tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param load_balancer_name: The name of the load balancer. - :type load_balancer_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns LoadBalancer - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.LoadBalancer] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, load_balancer_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -321,19 +354,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LoadBalancer', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, load_balancer_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a load balancer tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param load_balancer_name: The name of the load balancer. + :type load_balancer_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns LoadBalancer + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.LoadBalancer] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + load_balancer_name=load_balancer_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -342,10 +426,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LoadBalancer', response) + deserialized = self._deserialize('LoadBalancer', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -353,10 +434,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -409,7 +486,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -476,7 +553,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/local_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/local_network_gateways_operations.py index e89589bf5cde..d3a32b284091 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/local_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/local_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a local network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param parameters: Parameters supplied to the create or update local - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.LocalNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - LocalNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.LocalNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'LocalNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocalNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('LocalNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, local_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a local network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param parameters: Parameters supplied to the create or update local + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.LocalNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + LocalNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.LocalNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LocalNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('LocalNetworkGateway', response) + deserialized = self._deserialize('LocalNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified local network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, local_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified local network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,27 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, local_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a local network gateway tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param local_network_gateway_name: The name of the local network - gateway. - :type local_network_gateway_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - LocalNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.LocalNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, local_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -323,19 +355,71 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocalNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, local_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a local network gateway tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param local_network_gateway_name: The name of the local network + gateway. + :type local_network_gateway_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + LocalNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.LocalNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + local_network_gateway_name=local_network_gateway_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -344,10 +428,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LocalNetworkGateway', response) + deserialized = self._deserialize('LocalNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -355,10 +436,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -414,7 +491,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interface_ip_configurations_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interface_ip_configurations_operations.py index 96727144d3dc..cf02c1e6e8a5 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interface_ip_configurations_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interface_ip_configurations_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -155,7 +155,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interface_load_balancers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interface_load_balancers_operations.py index 8417f0a315b9..bea9b0cbe8c1 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interface_load_balancers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interface_load_balancers_operations.py @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interfaces_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interfaces_operations.py index db6e6b1a90ee..db40da83d0bf 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interfaces_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_interfaces_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -36,23 +37,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-10-01" # Construct URL @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,28 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param parameters: Parameters supplied to the create or update network - interface operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.NetworkInterface - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkInterface or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.NetworkInterface] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2017-10-01" # Construct URL @@ -232,19 +236,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkInterface') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkInterface', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkInterface', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_interface_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param parameters: Parameters supplied to the create or update network + interface operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.NetworkInterface + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkInterface or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.NetworkInterface] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkInterface', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkInterface', response) + deserialized = self._deserialize('NetworkInterface', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -277,26 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, network_interface_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a network interface tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkInterface or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.NetworkInterface] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, network_interface_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) api_version = "2017-10-01" @@ -328,19 +361,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkInterface', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, network_interface_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a network interface tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkInterface or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.NetworkInterface] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -349,10 +433,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkInterface', response) + deserialized = self._deserialize('NetworkInterface', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -360,10 +441,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -418,7 +495,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -487,7 +564,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -506,24 +583,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def get_effective_route_table( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all route tables applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.EffectiveRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_effective_route_table_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-10-01" # Construct URL @@ -550,18 +612,66 @@ def get_effective_route_table( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code == 200: + deserialized = self._deserialize('EffectiveRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_effective_route_table( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all route tables applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.EffectiveRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_effective_route_table_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -570,10 +680,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveRouteListResult', response) + deserialized = self._deserialize('EffectiveRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -581,10 +688,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -592,25 +695,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_effective_network_security_groups( - self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): - """Gets all network security groups applied to a network interface. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_interface_name: The name of the network interface. - :type network_interface_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - EffectiveNetworkSecurityGroupListResult or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.EffectiveNetworkSecurityGroupListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_effective_network_security_groups_initial( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-10-01" # Construct URL @@ -637,18 +724,67 @@ def list_effective_network_security_groups( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('EffectiveNetworkSecurityGroupListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_effective_network_security_groups( + self, resource_group_name, network_interface_name, custom_headers=None, raw=False, **operation_config): + """Gets all network security groups applied to a network interface. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_interface_name: The name of the network interface. + :type network_interface_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + EffectiveNetworkSecurityGroupListResult or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.EffectiveNetworkSecurityGroupListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_effective_network_security_groups_initial( + resource_group_name=resource_group_name, + network_interface_name=network_interface_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -657,10 +793,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) + deserialized = self._deserialize('EffectiveNetworkSecurityGroupListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -668,10 +801,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -737,7 +866,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -810,7 +939,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -885,7 +1014,7 @@ def get_virtual_machine_scale_set_network_interface( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -968,7 +1097,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -1049,7 +1178,7 @@ def get_virtual_machine_scale_set_ip_configuration( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_security_groups_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_security_groups_operations.py index 21ab137d9b4d..98759e28063b 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_security_groups_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_security_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,24 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -80,18 +66,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_security_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -104,10 +131,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a network security group in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param parameters: Parameters supplied to the create or update network - security group operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.NetworkSecurityGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.NetworkSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}' path_format_arguments = { @@ -232,19 +234,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'NetworkSecurityGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network security group in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param parameters: Parameters supplied to the create or update network + security group operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.NetworkSecurityGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.NetworkSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('NetworkSecurityGroup', response) + deserialized = self._deserialize('NetworkSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -277,27 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, network_security_group_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a network security group tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NetworkSecurityGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.NetworkSecurityGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, network_security_group_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -327,19 +359,71 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkSecurityGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, network_security_group_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a network security group tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NetworkSecurityGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.NetworkSecurityGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -348,10 +432,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetworkSecurityGroup', response) + deserialized = self._deserialize('NetworkSecurityGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -359,10 +440,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -415,7 +492,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -482,7 +559,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_watchers_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_watchers_operations.py index f33c47d25d46..2fbf8cb9924d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_watchers_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/network_watchers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -152,7 +153,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -170,23 +171,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network watcher resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}' path_format_arguments = { @@ -211,18 +198,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network watcher resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -235,10 +262,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -297,7 +320,7 @@ def update_tags( # Construct and send request request = self._client.patch(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -363,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -427,7 +450,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -447,16 +470,17 @@ def internal_paging(next_link=None, raw=False): return deserialized def get_topology( - self, resource_group_name, network_watcher_name, target_resource_group_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): """Gets the current network topology by resource group. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param network_watcher_name: The name of the network watcher. :type network_watcher_name: str - :param target_resource_group_name: The name of the target resource - group to perform topology on. - :type target_resource_group_name: str + :param parameters: Parameters that define the representation of + topology. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.TopologyParameters :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -467,8 +491,6 @@ def get_topology( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - parameters = models.TopologyParameters(target_resource_group_name=target_resource_group_name) - # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology' path_format_arguments = { @@ -498,7 +520,7 @@ def get_topology( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -516,28 +538,9 @@ def get_topology( return deserialized - def verify_ip_flow( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Verify IP flow from the specified VM to a location given the currently - configured NSG rules. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the IP flow to be verified. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.VerificationIPFlowParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VerificationIPFlowResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VerificationIPFlowResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _verify_ip_flow_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify' path_format_arguments = { @@ -565,19 +568,74 @@ def verify_ip_flow( body_content = self._serialize.body(parameters, 'VerificationIPFlowParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('VerificationIPFlowResult', response) + if response.status_code == 202: + deserialized = self._deserialize('VerificationIPFlowResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def verify_ip_flow( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Verify IP flow from the specified VM to a location given the currently + configured NSG rules. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the IP flow to be verified. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.VerificationIPFlowParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VerificationIPFlowResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VerificationIPFlowResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._verify_ip_flow_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -586,12 +644,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VerificationIPFlowResult', response) - if response.status_code == 202: - deserialized = self._deserialize('VerificationIPFlowResult', response) + deserialized = self._deserialize('VerificationIPFlowResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -599,10 +652,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -610,28 +659,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_next_hop( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Gets the next hop from the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param parameters: Parameters that define the source and destination - endpoint. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.NextHopParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - NextHopResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.NextHopResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_next_hop_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop' path_format_arguments = { @@ -659,19 +689,74 @@ def get_next_hop( body_content = self._serialize.body(parameters, 'NextHopParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('NextHopResult', response) + if response.status_code == 202: + deserialized = self._deserialize('NextHopResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_next_hop( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Gets the next hop from the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param parameters: Parameters that define the source and destination + endpoint. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.NextHopParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + NextHopResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.NextHopResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_next_hop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -680,12 +765,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NextHopResult', response) - if response.status_code == 202: - deserialized = self._deserialize('NextHopResult', response) + deserialized = self._deserialize('NextHopResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -693,10 +773,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -704,27 +780,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_vm_security_rules( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Gets the configured and effective security group rules on the specified - VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param target_resource_id: ID of the target VM. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - SecurityGroupViewResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.SecurityGroupViewResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_vm_security_rules_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.SecurityGroupViewParameters(target_resource_id=target_resource_id) # Construct URL @@ -754,73 +812,99 @@ def get_vm_security_rules( body_content = self._serialize.body(parameters, 'SecurityGroupViewParameters') # Construct and send request - def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - 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 + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - if response.status_code == 200: - deserialized = self._deserialize('SecurityGroupViewResult', response) - if response.status_code == 202: - deserialized = self._deserialize('SecurityGroupViewResult', response) + 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(deserialized, response) - return client_raw_response + deserialized = None - return deserialized + if response.status_code == 200: + deserialized = self._deserialize('SecurityGroupViewResult', response) + if response.status_code == 202: + deserialized = self._deserialize('SecurityGroupViewResult', response) if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - def get_troubleshooting( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Initiate troubleshooting on a specified resource. + return deserialized - :param resource_group_name: The name of the resource group. + def get_vm_security_rules( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the configured and effective security group rules on the specified + VM. + + :param resource_group_name: The name of the resource group. :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. + :param network_watcher_name: The name of the network watcher. :type network_watcher_name: str - :param parameters: Parameters that define the resource to - troubleshoot. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.TroubleshootingParameters + :param target_resource_id: ID of the target VM. + :type target_resource_id: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true + SecurityGroupViewResult or ClientRawResponse if raw=true :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.TroubleshootingResult] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.SecurityGroupViewResult] or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + raw_result = self._get_vm_security_rules_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = self._deserialize('SecurityGroupViewResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + + def _get_troubleshooting_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot' path_format_arguments = { @@ -848,19 +932,74 @@ def get_troubleshooting( body_content = self._serialize.body(parameters, 'TroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Initiate troubleshooting on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that define the resource to + troubleshoot. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.TroubleshootingParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -869,12 +1008,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -882,10 +1016,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -893,27 +1023,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_troubleshooting_result( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Get the last completed troubleshooting result on a specified resource. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource ID to query the - troubleshooting result. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - TroubleshootingResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.TroubleshootingResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_troubleshooting_result_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.QueryTroubleshootingParameters(target_resource_id=target_resource_id) # Construct URL @@ -943,19 +1055,73 @@ def get_troubleshooting_result( body_content = self._serialize.body(parameters, 'QueryTroubleshootingParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('TroubleshootingResult', response) + if response.status_code == 202: + deserialized = self._deserialize('TroubleshootingResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_troubleshooting_result( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Get the last completed troubleshooting result on a specified resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource ID to query the + troubleshooting result. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + TroubleshootingResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.TroubleshootingResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_troubleshooting_result_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -964,12 +1130,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('TroubleshootingResult', response) - if response.status_code == 202: - deserialized = self._deserialize('TroubleshootingResult', response) + deserialized = self._deserialize('TroubleshootingResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -977,10 +1138,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -988,6 +1145,58 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + + def _set_flow_log_configuration_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_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("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'FlowLogInformation') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + def set_flow_log_configuration( self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): """Configures flow log on a specified resource. @@ -1011,8 +1220,60 @@ def set_flow_log_configuration( or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + raw_result = self._set_flow_log_configuration_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + + def _get_flow_log_status_initial( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + parameters = models.FlowLogStatusParameters(target_resource_id=target_resource_id) + # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus' path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_name, 'str'), @@ -1035,22 +1296,77 @@ def set_flow_log_configuration( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'FlowLogInformation') + body_content = self._serialize.body(parameters, 'FlowLogStatusParameters') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('FlowLogInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('FlowLogInformation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_flow_log_status( + self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): + """Queries status of flow log on a specified resource. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param target_resource_id: The target resource where getting the flow + logging status. + :type target_resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FlowLogInformation or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.FlowLogInformation] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_flow_log_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + target_resource_id=target_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result # Construct and send request def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1059,12 +1375,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + deserialized = self._deserialize('FlowLogInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1072,10 +1383,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1083,32 +1390,13 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_flow_log_status( - self, resource_group_name, network_watcher_name, target_resource_id, custom_headers=None, raw=False, **operation_config): - """Queries status of flow log on a specified resource. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param target_resource_id: The target resource where getting the flow - logging status. - :type target_resource_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FlowLogInformation or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.FlowLogInformation] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - parameters = models.FlowLogStatusParameters(target_resource_id=target_resource_id) + def _check_connectivity_initial( + self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): + parameters = models.ConnectivityParameters(source=source, destination=destination) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck' path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_name, 'str'), @@ -1131,53 +1419,30 @@ def get_flow_log_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'FlowLogStatusParameters') + body_content = self._serialize.body(parameters, 'ConnectivityParameters') # Construct and send request - def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - 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 + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - if response.status_code == 200: - deserialized = self._deserialize('FlowLogInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('FlowLogInformation', response) + 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(deserialized, response) - return client_raw_response + deserialized = None - return deserialized + if response.status_code == 200: + deserialized = self._deserialize('ConnectivityInformation', response) + if response.status_code == 202: + deserialized = self._deserialize('ConnectivityInformation', response) if raw: - response = long_running_send() - return get_long_running_output(response) + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) + return deserialized def check_connectivity( self, resource_group_name, network_watcher_name, source, destination, custom_headers=None, raw=False, **operation_config): @@ -1206,48 +1471,31 @@ def check_connectivity( or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - parameters = models.ConnectivityParameters(source=source, destination=destination) - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck' - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'networkWatcherName': self._serialize.url("network_watcher_name", network_watcher_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("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'ConnectivityParameters') + raw_result = self._check_connectivity_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + source=source, + destination=destination, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result # Construct and send request def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1256,12 +1504,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectivityInformation', response) - if response.status_code == 202: - deserialized = self._deserialize('ConnectivityInformation', response) + deserialized = self._deserialize('ConnectivityInformation', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1269,10 +1512,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1280,30 +1519,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_azure_reachability_report( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Gets the relative latency score for internet service providers from a - specified location to Azure regions. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that determine Azure reachability report - configuration. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.AzureReachabilityReportParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - AzureReachabilityReport or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.AzureReachabilityReport] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_azure_reachability_report_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport' path_format_arguments = { @@ -1331,19 +1549,76 @@ def get_azure_reachability_report( body_content = self._serialize.body(parameters, 'AzureReachabilityReportParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('AzureReachabilityReport', response) + if response.status_code == 202: + deserialized = self._deserialize('AzureReachabilityReport', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_azure_reachability_report( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Gets the relative latency score for internet service providers from a + specified location to Azure regions. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that determine Azure reachability report + configuration. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.AzureReachabilityReportParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + AzureReachabilityReport or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.AzureReachabilityReport] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_azure_reachability_report_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1352,12 +1627,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AzureReachabilityReport', response) - if response.status_code == 202: - deserialized = self._deserialize('AzureReachabilityReport', response) + deserialized = self._deserialize('AzureReachabilityReport', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1365,10 +1635,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1376,30 +1642,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_available_providers( - self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): - """Lists all available internet service providers for a specified Azure - region. - :param resource_group_name: The name of the network watcher resource - group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher resource. - :type network_watcher_name: str - :param parameters: Parameters that scope the list of available - providers. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.AvailableProvidersListParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - AvailableProvidersList or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.AvailableProvidersList] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _list_available_providers_initial( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList' path_format_arguments = { @@ -1427,19 +1672,76 @@ def list_available_providers( body_content = self._serialize.body(parameters, 'AvailableProvidersListParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('AvailableProvidersList', response) + if response.status_code == 202: + deserialized = self._deserialize('AvailableProvidersList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_available_providers( + self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Lists all available internet service providers for a specified Azure + region. + + :param resource_group_name: The name of the network watcher resource + group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher resource. + :type network_watcher_name: str + :param parameters: Parameters that scope the list of available + providers. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.AvailableProvidersListParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + AvailableProvidersList or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.AvailableProvidersList] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._list_available_providers_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1448,12 +1750,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AvailableProvidersList', response) - if response.status_code == 202: - deserialized = self._deserialize('AvailableProvidersList', response) + deserialized = self._deserialize('AvailableProvidersList', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1461,10 +1758,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/operations.py index 6980465cfd41..eaeef283a100 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/operations.py @@ -78,7 +78,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/packet_captures_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/packet_captures_operations.py index 2520b5f9347b..a5fa84cd7428 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/packet_captures_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/packet_captures_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,29 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create( - self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create and start a packet capture on the specified VM. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param parameters: Parameters that define the create packet capture - operation. - :type parameters: ~azure.mgmt.network.v2017_10_01.models.PacketCapture - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.PacketCaptureResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -89,19 +70,74 @@ def create( body_content = self._serialize.body(parameters, 'PacketCapture') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('PacketCaptureResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, network_watcher_name, packet_capture_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create and start a packet capture on the specified VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param parameters: Parameters that define the create packet capture + operation. + :type parameters: ~azure.mgmt.network.v2017_10_01.models.PacketCapture + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.PacketCaptureResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,10 +146,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('PacketCaptureResult', response) + deserialized = self._deserialize('PacketCaptureResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -121,10 +154,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +207,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,25 +225,9 @@ def get( return deserialized - def delete( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}' path_format_arguments = { @@ -240,18 +253,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -264,10 +320,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -275,25 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def stop( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Stops a specified packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the network watcher. - :type network_watcher_name: str - :param packet_capture_name: The name of the packet capture session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _stop_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop' path_format_arguments = { @@ -319,18 +355,61 @@ def stop( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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 stop( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Stops a specified packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the network watcher. + :type network_watcher_name: str + :param packet_capture_name: The name of the packet capture session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +422,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -354,27 +429,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_status( - self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): - """Query the status of a running packet capture session. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_watcher_name: The name of the Network Watcher resource. - :type network_watcher_name: str - :param packet_capture_name: The name given to the packet capture - session. - :type packet_capture_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PacketCaptureQueryStatusResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.PacketCaptureQueryStatusResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_status_initial( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus' path_format_arguments = { @@ -400,18 +457,72 @@ def get_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('PacketCaptureQueryStatusResult', response) + if response.status_code == 202: + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_status( + self, resource_group_name, network_watcher_name, packet_capture_name, custom_headers=None, raw=False, **operation_config): + """Query the status of a running packet capture session. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_watcher_name: The name of the Network Watcher resource. + :type network_watcher_name: str + :param packet_capture_name: The name given to the packet capture + session. + :type packet_capture_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PacketCaptureQueryStatusResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.PacketCaptureQueryStatusResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_status_initial( + resource_group_name=resource_group_name, + network_watcher_name=network_watcher_name, + packet_capture_name=packet_capture_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -420,12 +531,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) - if response.status_code == 202: - deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) + deserialized = self._deserialize('PacketCaptureQueryStatusResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -433,10 +539,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -495,7 +597,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/public_ip_addresses_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/public_ip_addresses_operations.py index 575255bf28b4..83a0e81df1c9 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/public_ip_addresses_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/public_ip_addresses_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -36,23 +37,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the subnet. - :type public_ip_address_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): api_version = "2017-10-01" # Construct URL @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, public_ip_address_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the subnet. + :type public_ip_address_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +186,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,28 +204,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a static or dynamic public IP address. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the public IP address. - :type public_ip_address_name: str - :param parameters: Parameters supplied to the create or update public - IP address operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.PublicIPAddress - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PublicIPAddress or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.PublicIPAddress] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2017-10-01" # Construct URL @@ -232,19 +236,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'PublicIPAddress') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PublicIPAddress', response) + if response.status_code == 201: + deserialized = self._deserialize('PublicIPAddress', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, public_ip_address_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a static or dynamic public IP address. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. + :type public_ip_address_name: str + :param parameters: Parameters supplied to the create or update public + IP address operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.PublicIPAddress + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PublicIPAddress or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.PublicIPAddress] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +312,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PublicIPAddress', response) - if response.status_code == 201: - deserialized = self._deserialize('PublicIPAddress', response) + deserialized = self._deserialize('PublicIPAddress', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +320,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -277,26 +327,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, public_ip_address_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates public IP address tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param public_ip_address_name: The name of the public IP address. - :type public_ip_address_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - PublicIPAddress or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.PublicIPAddress] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, public_ip_address_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) api_version = "2017-10-01" @@ -328,19 +361,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PublicIPAddress', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, public_ip_address_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates public IP address tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param public_ip_address_name: The name of the public IP address. + :type public_ip_address_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + PublicIPAddress or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.PublicIPAddress] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + public_ip_address_name=public_ip_address_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -349,10 +433,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('PublicIPAddress', response) + deserialized = self._deserialize('PublicIPAddress', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -360,10 +441,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -418,7 +495,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -487,7 +564,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -561,7 +638,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -644,7 +721,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -725,7 +802,7 @@ def get_virtual_machine_scale_set_public_ip_address( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_filter_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_filter_rules_operations.py index bc70259534ab..47a20db8043d 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_filter_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_filter_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified rule from a route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the rule. - :type rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified rule from a route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,30 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the create - or update route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2017_10_01.models.RouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -233,19 +236,77 @@ def create_or_update( body_content = self._serialize.body(route_filter_rule_parameters, 'RouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the create + or update route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2017_10_01.models.RouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -254,12 +315,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -267,10 +323,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -278,30 +330,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route in the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param rule_name: The name of the route filter rule. - :type rule_name: str - :param route_filter_rule_parameters: Parameters supplied to the update - route filter rule operation. - :type route_filter_rule_parameters: - ~azure.mgmt.network.v2017_10_01.models.PatchRouteFilterRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - RouteFilterRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteFilterRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}' path_format_arguments = { @@ -330,19 +361,75 @@ def update( body_content = self._serialize.body(route_filter_rule_parameters, 'PatchRouteFilterRule') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route in the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param rule_name: The name of the route filter rule. + :type rule_name: str + :param route_filter_rule_parameters: Parameters supplied to the update + route filter rule operation. + :type route_filter_rule_parameters: + ~azure.mgmt.network.v2017_10_01.models.PatchRouteFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + RouteFilterRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteFilterRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + rule_name=rule_name, + route_filter_rule_parameters=route_filter_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -351,10 +438,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilterRule', response) + deserialized = self._deserialize('RouteFilterRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -362,10 +446,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -424,7 +504,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_filters_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_filters_operations.py index f6a5bfb76036..647855811294 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_filters_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_filters_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route filter. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_filter_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route filter. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the create or - update route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2017_10_01.models.RouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(route_filter_parameters, 'RouteFilter') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the create or + update route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2017_10_01.models.RouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,28 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): - """Updates a route filter in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_filter_name: The name of the route filter. - :type route_filter_name: str - :param route_filter_parameters: Parameters supplied to the update - route filter operation. - :type route_filter_parameters: - ~azure.mgmt.network.v2017_10_01.models.PatchRouteFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteFilter - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteFilter] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}' path_format_arguments = { @@ -322,19 +353,72 @@ def update( body_content = self._serialize.body(route_filter_parameters, 'PatchRouteFilter') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteFilter', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, route_filter_name, route_filter_parameters, custom_headers=None, raw=False, **operation_config): + """Updates a route filter in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_filter_name: The name of the route filter. + :type route_filter_name: str + :param route_filter_parameters: Parameters supplied to the update + route filter operation. + :type route_filter_parameters: + ~azure.mgmt.network.v2017_10_01.models.PatchRouteFilter + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteFilter + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteFilter] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + route_filter_name=route_filter_name, + route_filter_parameters=route_filter_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +427,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteFilter', response) + deserialized = self._deserialize('RouteFilter', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -354,10 +435,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -413,7 +490,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -477,7 +554,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_tables_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_tables_operations.py index dcdb350f61b9..25ca97443f5a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_tables_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/route_tables_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,27 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create or updates a route table in a specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param parameters: Parameters supplied to the create or update route - table operation. - :type parameters: ~azure.mgmt.network.v2017_10_01.models.RouteTable - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteTable - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteTable] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}' path_format_arguments = { @@ -227,19 +232,73 @@ def create_or_update( body_content = self._serialize.body(parameters, 'RouteTable') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteTable', response) + if response.status_code == 201: + deserialized = self._deserialize('RouteTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or updates a route table in a specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param parameters: Parameters supplied to the create or update route + table operation. + :type parameters: ~azure.mgmt.network.v2017_10_01.models.RouteTable + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteTable + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteTable] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -248,12 +307,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteTable', response) - if response.status_code == 201: - deserialized = self._deserialize('RouteTable', response) + deserialized = self._deserialize('RouteTable', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -261,10 +315,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -272,26 +322,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, route_table_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a route table tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns RouteTable - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteTable] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, route_table_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -321,19 +354,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RouteTable', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, route_table_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a route table tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns RouteTable + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.RouteTable] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -342,10 +426,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RouteTable', response) + deserialized = self._deserialize('RouteTable', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -353,10 +434,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -412,7 +489,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -476,7 +553,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/routes_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/routes_operations.py index 23242353c1f1..8f27654ecf55 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/routes_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/routes_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified route from a route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, route_table_name, route_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified route from a route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -163,7 +187,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -181,29 +205,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a route in the specified route table. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param route_table_name: The name of the route table. - :type route_table_name: str - :param route_name: The name of the route. - :type route_name: str - :param route_parameters: Parameters supplied to the create or update - route operation. - :type route_parameters: ~azure.mgmt.network.v2017_10_01.models.Route - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Route or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.Route] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}' path_format_arguments = { @@ -232,19 +236,76 @@ def create_or_update( body_content = self._serialize.body(route_parameters, 'Route') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Route', response) + if response.status_code == 201: + deserialized = self._deserialize('Route', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, route_table_name, route_name, route_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a route in the specified route table. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param route_table_name: The name of the route table. + :type route_table_name: str + :param route_name: The name of the route. + :type route_name: str + :param route_parameters: Parameters supplied to the create or update + route operation. + :type route_parameters: ~azure.mgmt.network.v2017_10_01.models.Route + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Route or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.Route] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + route_table_name=route_table_name, + route_name=route_name, + route_parameters=route_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -253,12 +314,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Route', response) - if response.status_code == 201: - deserialized = self._deserialize('Route', response) + deserialized = self._deserialize('Route', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -266,10 +322,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -328,7 +380,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/security_rules_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/security_rules_operations.py index b3a64186a6f8..81f8e6d5421a 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/security_rules_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/security_rules_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified network security rule. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, network_security_group_name, security_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified network security rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,32 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a security rule in the specified network security - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param network_security_group_name: The name of the network security - group. - :type network_security_group_name: str - :param security_rule_name: The name of the security rule. - :type security_rule_name: str - :param security_rule_parameters: Parameters supplied to the create or - update network security rule operation. - :type security_rule_parameters: - ~azure.mgmt.network.v2017_10_01.models.SecurityRule - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns SecurityRule - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.SecurityRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}' path_format_arguments = { @@ -237,19 +238,79 @@ def create_or_update( body_content = self._serialize.body(security_rule_parameters, 'SecurityRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SecurityRule', response) + if response.status_code == 201: + deserialized = self._deserialize('SecurityRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a security rule in the specified network security + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param network_security_group_name: The name of the network security + group. + :type network_security_group_name: str + :param security_rule_name: The name of the security rule. + :type security_rule_name: str + :param security_rule_parameters: Parameters supplied to the create or + update network security rule operation. + :type security_rule_parameters: + ~azure.mgmt.network.v2017_10_01.models.SecurityRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns SecurityRule + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.SecurityRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + network_security_group_name=network_security_group_name, + security_rule_name=security_rule_name, + security_rule_parameters=security_rule_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -258,12 +319,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SecurityRule', response) - if response.status_code == 201: - deserialized = self._deserialize('SecurityRule', response) + deserialized = self._deserialize('SecurityRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -271,10 +327,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -334,7 +386,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/subnets_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/subnets_operations.py index b6d479930f63..9afc58f18cbd 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/subnets_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/subnets_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,25 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified subnet. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -82,18 +67,61 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, subnet_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified subnet. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -106,10 +134,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -167,7 +191,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -185,29 +209,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a subnet in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param subnet_name: The name of the subnet. - :type subnet_name: str - :param subnet_parameters: Parameters supplied to the create or update - subnet operation. - :type subnet_parameters: ~azure.mgmt.network.v2017_10_01.models.Subnet - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Subnet or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.Subnet] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}' path_format_arguments = { @@ -236,19 +240,76 @@ def create_or_update( body_content = self._serialize.body(subnet_parameters, 'Subnet') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Subnet', response) + if response.status_code == 201: + deserialized = self._deserialize('Subnet', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a subnet in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param subnet_name: The name of the subnet. + :type subnet_name: str + :param subnet_parameters: Parameters supplied to the create or update + subnet operation. + :type subnet_parameters: ~azure.mgmt.network.v2017_10_01.models.Subnet + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Subnet or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.Subnet] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + subnet_name=subnet_name, + subnet_parameters=subnet_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -257,12 +318,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Subnet', response) - if response.status_code == 201: - deserialized = self._deserialize('Subnet', response) + deserialized = self._deserialize('Subnet', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -270,10 +326,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -332,7 +384,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/usages_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/usages_operations.py index 79b734343a0f..446d3ff6056f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/usages_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/usages_operations.py @@ -85,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_gateway_connections_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_gateway_connections_operations.py index ae2b26980704..166445248a85 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_gateway_connections_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_gateway_connections_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway connection in the - specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param parameters: Parameters supplied to the create or update virtual - network gateway connection operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGatewayConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGatewayConnection or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGatewayConnection] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGatewayConnection') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway connection in the + specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param parameters: Parameters supplied to the create or update virtual + network gateway connection operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGatewayConnection + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGatewayConnection or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGatewayConnection] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) + deserialized = self._deserialize('VirtualNetworkGatewayConnection', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -181,7 +209,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -199,24 +227,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network Gateway connection. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}' path_format_arguments = { @@ -241,18 +254,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_connection_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network Gateway connection. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -265,10 +319,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -276,28 +326,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, virtual_network_gateway_connection_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a virtual network gateway connection tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The name of the - virtual network gateway connection. - :type virtual_network_gateway_connection_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGatewayConnectionListEntity or ClientRawResponse if - raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGatewayConnectionListEntity] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, virtual_network_gateway_connection_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -327,19 +358,72 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGatewayConnectionListEntity', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, virtual_network_gateway_connection_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a virtual network gateway connection tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The name of the + virtual network gateway connection. + :type virtual_network_gateway_connection_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGatewayConnectionListEntity or ClientRawResponse if + raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGatewayConnectionListEntity] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -348,10 +432,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGatewayConnectionListEntity', response) + deserialized = self._deserialize('VirtualNetworkGatewayConnectionListEntity', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -359,10 +440,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -370,30 +447,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def set_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): - """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection name. - :type virtual_network_gateway_connection_name: str - :param value: The virtual network connection shared key value. - :type value: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ConnectionSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _set_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionSharedKey(value=value) # Construct URL @@ -423,19 +479,76 @@ def set_shared_key( body_content = self._serialize.body(parameters, 'ConnectionSharedKey') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ConnectionSharedKey', response) + if response.status_code == 201: + deserialized = self._deserialize('ConnectionSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def set_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, value, custom_headers=None, raw=False, **operation_config): + """The Put VirtualNetworkGatewayConnectionSharedKey operation sets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection name. + :type virtual_network_gateway_connection_name: str + :param value: The virtual network connection shared key value. + :type value: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ConnectionSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._set_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + value=value, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -444,12 +557,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionSharedKey', response) - if response.status_code == 201: - deserialized = self._deserialize('ConnectionSharedKey', response) + deserialized = self._deserialize('ConnectionSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -457,10 +565,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -514,7 +618,7 @@ def get_shared_key( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -581,7 +685,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -600,31 +704,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset_shared_key( - self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): - """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the - virtual network gateway connection shared key for passed virtual - network gateway connection in the specified resource group through - Network resource provider. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_connection_name: The virtual network - gateway connection reset shared key Name. - :type virtual_network_gateway_connection_name: str - :param key_length: The virtual network connection reset shared key - length, should between 1 and 128. - :type key_length: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ConnectionResetSharedKey or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ConnectionResetSharedKey] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_shared_key_initial( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): parameters = models.ConnectionResetSharedKey(key_length=key_length) # Construct URL @@ -654,19 +736,75 @@ def reset_shared_key( body_content = self._serialize.body(parameters, 'ConnectionResetSharedKey') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('ConnectionResetSharedKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def reset_shared_key( + self, resource_group_name, virtual_network_gateway_connection_name, key_length, custom_headers=None, raw=False, **operation_config): + """The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + virtual network gateway connection shared key for passed virtual + network gateway connection in the specified resource group through + Network resource provider. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_connection_name: The virtual network + gateway connection reset shared key Name. + :type virtual_network_gateway_connection_name: str + :param key_length: The virtual network connection reset shared key + length, should between 1 and 128. + :type key_length: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ConnectionResetSharedKey or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.ConnectionResetSharedKey] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._reset_shared_key_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_connection_name=virtual_network_gateway_connection_name, + key_length=key_length, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -675,10 +813,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ConnectionResetSharedKey', response) + deserialized = self._deserialize('ConnectionResetSharedKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -686,10 +821,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_gateways_operations.py index 30895f060187..bfa17057ab27 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_gateways_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,30 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network gateway in the specified resource - group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to create or update virtual - network gateway operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGateway - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -89,19 +69,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkGateway') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network gateway in the specified resource + group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to create or update virtual + network gateway operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGateway + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -110,12 +147,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +155,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -178,7 +206,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,24 +224,9 @@ def get( return deserialized - def delete( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network gateway. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}' path_format_arguments = { @@ -238,18 +251,59 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network gateway. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -262,10 +316,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,27 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, virtual_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a virtual network gateway tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, virtual_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -323,19 +355,71 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, virtual_network_gateway_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a virtual network gateway tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -344,10 +428,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) + deserialized = self._deserialize('VirtualNetworkGateway', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -355,10 +436,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -414,7 +491,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -486,7 +563,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -505,29 +582,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def reset( - self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): - """Resets the primary of the virtual network gateway in the specified - resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param gateway_vip: Virtual network gateway vip address supplied to - the begin reset of the active-active feature enabled gateway. - :type gateway_vip: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkGateway or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGateway] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _reset_initial( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset' path_format_arguments = { @@ -554,71 +611,98 @@ def reset( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - deserialized = None + deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkGateway', response) + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkGateway', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - return deserialized + return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - - def generatevpnclientpackage( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Generates VPN client package for P2S client of the virtual network - gateway in the specified resource group. + def reset( + self, resource_group_name, virtual_network_gateway_name, gateway_vip=None, custom_headers=None, raw=False, **operation_config): + """Resets the primary of the virtual network gateway in the specified + resource group. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param virtual_network_gateway_name: The name of the virtual network gateway. :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to the generate virtual network - gateway VPN client package operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.VpnClientParameters + :param gateway_vip: Virtual network gateway vip address supplied to + the begin reset of the active-active feature enabled gateway. + :type gateway_vip: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :return: An instance of AzureOperationPoller that returns str or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or - ~msrest.pipeline.ClientRawResponse + :return: An instance of AzureOperationPoller that returns + VirtualNetworkGateway or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGateway] + or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + raw_result = self._reset_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + gateway_vip=gateway_vip, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = self._deserialize('VirtualNetworkGateway', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + + def _generatevpnclientpackage_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage' path_format_arguments = { @@ -646,19 +730,73 @@ def generatevpnclientpackage( body_content = self._serialize.body(parameters, 'VpnClientParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def generatevpnclientpackage( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Generates VPN client package for P2S client of the virtual network + gateway in the specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network + gateway VPN client package operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.VpnClientParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns str or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._generatevpnclientpackage_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -667,10 +805,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -678,10 +813,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -689,30 +820,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def generate_vpn_profile( - self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): - """Generates VPN profile for P2S client of the virtual network gateway in - the specified resource group. Used for IKEV2 and radius based - authentication. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param parameters: Parameters supplied to the generate virtual network - gateway VPN client package operation. - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.VpnClientParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns str or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _generate_vpn_profile_initial( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile' path_format_arguments = { @@ -740,19 +850,74 @@ def generate_vpn_profile( body_content = self._serialize.body(parameters, 'VpnClientParameters') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **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('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def generate_vpn_profile( + self, resource_group_name, virtual_network_gateway_name, parameters, custom_headers=None, raw=False, **operation_config): + """Generates VPN profile for P2S client of the virtual network gateway in + the specified resource group. Used for IKEV2 and radius based + authentication. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param parameters: Parameters supplied to the generate virtual network + gateway VPN client package operation. + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.VpnClientParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns str or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._generate_vpn_profile_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -761,10 +926,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -772,10 +934,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -783,26 +941,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_vpn_profile_package_url( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """Gets pre-generated VPN profile for P2S client of the virtual network - gateway in the specified resource group. The profile needs to be - generated first using generateVpnProfile. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns str or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_vpn_profile_package_url_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl' path_format_arguments = { @@ -827,18 +968,68 @@ def get_vpn_profile_package_url( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('str', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def get_vpn_profile_package_url( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """Gets pre-generated VPN profile for P2S client of the virtual network + gateway in the specified resource group. The profile needs to be + generated first using generateVpnProfile. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns str or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_vpn_profile_package_url_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -847,10 +1038,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -858,10 +1046,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -869,27 +1053,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_bgp_peer_status( - self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): - """The GetBgpPeerStatus operation retrieves the status of all BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer to retrieve the status of. - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - BgpPeerStatusListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.BgpPeerStatusListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_bgp_peer_status_initial( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus' path_format_arguments = { @@ -916,18 +1082,70 @@ def get_bgp_peer_status( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BgpPeerStatusListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_bgp_peer_status( + self, resource_group_name, virtual_network_gateway_name, peer=None, custom_headers=None, raw=False, **operation_config): + """The GetBgpPeerStatus operation retrieves the status of all BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer to retrieve the status of. + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + BgpPeerStatusListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.BgpPeerStatusListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_bgp_peer_status_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -936,10 +1154,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BgpPeerStatusListResult', response) + deserialized = self._deserialize('BgpPeerStatusListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -947,10 +1162,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1001,7 +1212,7 @@ def supported_vpn_devices( # Construct and send request request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -1019,26 +1230,9 @@ def supported_vpn_devices( return deserialized - def get_learned_routes( - self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - has learned, including routes learned from BGP peers. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_learned_routes_initial( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes' path_format_arguments = { @@ -1063,18 +1257,68 @@ def get_learned_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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 - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_learned_routes( + self, resource_group_name, virtual_network_gateway_name, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + has learned, including routes learned from BGP peers. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_learned_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1083,10 +1327,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1094,10 +1335,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1105,28 +1342,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def get_advertised_routes( - self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): - """This operation retrieves a list of routes the virtual network gateway - is advertising to the specified peer. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_gateway_name: The name of the virtual network - gateway. - :type virtual_network_gateway_name: str - :param peer: The IP address of the peer - :type peer: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - GatewayRouteListResult or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.GatewayRouteListResult] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _get_advertised_routes_initial( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes' path_format_arguments = { @@ -1152,18 +1370,71 @@ def get_advertised_routes( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **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('GatewayRouteListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_advertised_routes( + self, resource_group_name, virtual_network_gateway_name, peer, custom_headers=None, raw=False, **operation_config): + """This operation retrieves a list of routes the virtual network gateway + is advertising to the specified peer. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_gateway_name: The name of the virtual network + gateway. + :type virtual_network_gateway_name: str + :param peer: The IP address of the peer + :type peer: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + GatewayRouteListResult or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.GatewayRouteListResult] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._get_advertised_routes_initial( + resource_group_name=resource_group_name, + virtual_network_gateway_name=virtual_network_gateway_name, + peer=peer, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -1172,10 +1443,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteListResult', response) + deserialized = self._deserialize('GatewayRouteListResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1183,10 +1451,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -1246,7 +1510,7 @@ def vpn_device_configuration_script( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_peerings_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_peerings_operations.py index d81797cf9fee..ebe209a4dd2c 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_peerings_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_network_peerings_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,26 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network peering. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the virtual network - peering. - :type virtual_network_peering_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -83,18 +67,62 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the virtual network + peering. + :type virtual_network_peering_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -107,10 +135,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -165,7 +189,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -183,30 +207,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a peering in the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param virtual_network_peering_name: The name of the peering. - :type virtual_network_peering_name: str - :param virtual_network_peering_parameters: Parameters supplied to the - create or update virtual network peering operation. - :type virtual_network_peering_parameters: - ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkPeering - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkPeering or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkPeering] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}' path_format_arguments = { @@ -235,19 +238,77 @@ def create_or_update( body_content = self._serialize.body(virtual_network_peering_parameters, 'VirtualNetworkPeering') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkPeering', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkPeering', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a peering in the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param virtual_network_peering_name: The name of the peering. + :type virtual_network_peering_name: str + :param virtual_network_peering_parameters: Parameters supplied to the + create or update virtual network peering operation. + :type virtual_network_peering_parameters: + ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkPeering + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkPeering or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetworkPeering] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + virtual_network_peering_name=virtual_network_peering_name, + virtual_network_peering_parameters=virtual_network_peering_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -256,12 +317,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkPeering', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkPeering', response) + deserialized = self._deserialize('VirtualNetworkPeering', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -269,10 +325,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -331,7 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_networks_operations.py b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_networks_operations.py index 971bf7daf9c6..a32a364c7a1f 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_networks_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/virtual_networks_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,23 +39,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def delete( - self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): - """Deletes the specified virtual network. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -79,18 +66,58 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - def long_running_send(): + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_network_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified virtual network. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -103,10 +130,6 @@ def get_long_running_output(response): client_raw_response = ClientRawResponse(None, response) return client_raw_response - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -161,7 +184,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -179,28 +202,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a virtual network in the specified resource group. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param parameters: Parameters supplied to the create or update virtual - network operation - :type parameters: - ~azure.mgmt.network.v2017_10_01.models.VirtualNetwork - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetwork or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetwork] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}' path_format_arguments = { @@ -228,19 +232,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetwork') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetwork', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, virtual_network_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a virtual network in the specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param parameters: Parameters supplied to the create or update virtual + network operation + :type parameters: + ~azure.mgmt.network.v2017_10_01.models.VirtualNetwork + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetwork or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetwork] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -249,12 +308,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetwork', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetwork', response) + deserialized = self._deserialize('VirtualNetwork', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -262,10 +316,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -273,26 +323,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update_tags( - self, resource_group_name, virtual_network_name, tags=None, custom_headers=None, raw=False, **operation_config): - """Updates a virtual network tags. - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param virtual_network_name: The name of the virtual network. - :type virtual_network_name: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetwork or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetwork] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_tags_initial( + self, resource_group_name, virtual_network_name, tags=None, custom_headers=None, raw=False, **operation_config): parameters = models.TagsObject(tags=tags) # Construct URL @@ -322,19 +355,70 @@ def update_tags( body_content = self._serialize.body(parameters, 'TagsObject') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_tags( + self, resource_group_name, virtual_network_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates a virtual network tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_network_name: The name of the virtual network. + :type virtual_network_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetwork or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.network.v2017_10_01.models.VirtualNetwork] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -343,10 +427,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VirtualNetwork', response) + deserialized = self._deserialize('VirtualNetwork', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -354,10 +435,6 @@ def get_long_running_output(response): return deserialized - if raw: - response = long_running_send() - return get_long_running_output(response) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -410,7 +487,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -477,7 +554,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -544,7 +621,7 @@ def check_ip_address_availability( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -613,7 +690,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-network/build.json b/azure-mgmt-network/build.json index 7c4dfa463368..dd9f1438a8d3 100644 --- a/azure-mgmt-network/build.json +++ b/azure-mgmt-network/build.json @@ -1,5 +1,425 @@ { - "autorest": "1.0.1-20170502-2300-nightly", - "date": "2017-05-03T20:13:42Z", - "version": "1.0.0rc3" + "autorest": [ + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest-core", + "version": "2.0.4228", + "engines": { + "node": ">=7.10.0" + }, + "dependencies": {}, + "optionalDependencies": {}, + "devDependencies": { + "@types/commonmark": "^0.27.0", + "@types/js-yaml": "^3.10.0", + "@types/jsonpath": "^0.1.29", + "@types/node": "^8.0.53", + "@types/source-map": "^0.5.0", + "@types/yargs": "^8.0.2", + "@types/z-schema": "^3.16.31", + "dts-generator": "^2.1.0", + "mocha": "^4.0.1", + "mocha-typescript": "^1.1.7", + "shx": "0.2.2", + "static-link": "^0.2.3", + "vscode-jsonrpc": "^3.3.1" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core", + "_shasum": "b3897b8615417aa07cf9113d4bd18862b32f82f8", + "_shrinkwrap": null, + "bin": { + "autorest-core": "./dist/app.js", + "autorest-language-service": "dist/language-service/language-service.js" + }, + "_id": "@microsoft.azure/autorest-core@2.0.4228", + "_from": "file:/root/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core", + "_requested": { + "type": "directory", + "where": "/git-restapi", + "raw": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core", + "rawSpec": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core", + "saveSpec": "file:/root/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core", + "fetchSpec": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core" + }, + "_spec": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core", + "_where": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4228/node_modules/@microsoft.azure/autorest-core" + }, + "extensionManager": { + "installationPath": "/root/.autorest", + "sharedLock": { + "name": "/root/.autorest", + "exclusiveLock": { + "name": "_root_.autorest.exclusive-lock", + "options": { + "port": 45234, + "host": "2130706813", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.exclusive-lock:45234" + }, + "busyLock": { + "name": "_root_.autorest.busy-lock", + "options": { + "port": 37199, + "host": "2130756895", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.busy-lock:37199" + }, + "personalLock": { + "name": "_root_.autorest.1382.036574883898.personal-lock", + "options": { + "port": 55913, + "host": "2130709233", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.1382.036574883898.personal-lock:55913" + }, + "file": "/tmp/_root_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/root/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest-core", + "version": "2.0.4230", + "engines": { + "node": ">=7.10.0" + }, + "dependencies": {}, + "optionalDependencies": {}, + "devDependencies": { + "@types/commonmark": "^0.27.0", + "@types/js-yaml": "^3.10.0", + "@types/jsonpath": "^0.1.29", + "@types/node": "^8.0.53", + "@types/source-map": "0.5.0", + "@types/yargs": "^8.0.2", + "@types/z-schema": "^3.16.31", + "dts-generator": "^2.1.0", + "mocha": "^4.0.1", + "mocha-typescript": "^1.1.7", + "shx": "0.2.2", + "static-link": "^0.2.3", + "vscode-jsonrpc": "^3.3.1" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core", + "_shasum": "3c9b387fbe18ce3a54b68bc0c24ddb0a4c850f25", + "_shrinkwrap": null, + "bin": { + "autorest-core": "./dist/app.js", + "autorest-language-service": "dist/language-service/language-service.js" + }, + "_id": "@microsoft.azure/autorest-core@2.0.4230", + "_from": "file:/root/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core", + "_requested": { + "type": "directory", + "where": "/git-restapi", + "raw": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core", + "rawSpec": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core", + "saveSpec": "file:/root/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core", + "fetchSpec": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core" + }, + "_spec": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core", + "_where": "/root/.autorest/@microsoft.azure_autorest-core@2.0.4230/node_modules/@microsoft.azure/autorest-core" + }, + "extensionManager": { + "installationPath": "/root/.autorest", + "sharedLock": { + "name": "/root/.autorest", + "exclusiveLock": { + "name": "_root_.autorest.exclusive-lock", + "options": { + "port": 45234, + "host": "2130706813", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.exclusive-lock:45234" + }, + "busyLock": { + "name": "_root_.autorest.busy-lock", + "options": { + "port": 37199, + "host": "2130756895", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.busy-lock:37199" + }, + "personalLock": { + "name": "_root_.autorest.1382.036574883898.personal-lock", + "options": { + "port": 55913, + "host": "2130709233", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.1382.036574883898.personal-lock:55913" + }, + "file": "/tmp/_root_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/root/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest.modeler", + "version": "2.0.21", + "dependencies": { + "dotnet-2.0.0": "^1.3.2" + }, + "optionalDependencies": {}, + "devDependencies": { + "coffee-script": "^1.11.1", + "dotnet-sdk-2.0.0": "^1.1.1", + "gulp": "^3.9.1", + "gulp-filter": "^5.0.0", + "gulp-line-ending-corrector": "^1.0.1", + "iced-coffee-script": "^108.0.11", + "marked": "^0.3.6", + "marked-terminal": "^2.0.0", + "moment": "^2.17.1", + "run-sequence": "*", + "shx": "^0.2.2", + "through2-parallel": "^0.1.3", + "yargs": "^8.0.2", + "yarn": "^1.0.2" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/root/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "_shasum": "3ce7d3939124b31830be15e5de99b9b7768afb90", + "_shrinkwrap": null, + "bin": null, + "_id": "@microsoft.azure/autorest.modeler@2.0.21", + "_from": "file:/root/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "_requested": { + "type": "directory", + "where": "/git-restapi", + "raw": "/root/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "rawSpec": "/root/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "saveSpec": "file:/root/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "fetchSpec": "/root/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler" + }, + "_spec": "/root/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "_where": "/root/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler" + }, + "extensionManager": { + "installationPath": "/root/.autorest", + "sharedLock": { + "name": "/root/.autorest", + "exclusiveLock": { + "name": "_root_.autorest.exclusive-lock", + "options": { + "port": 45234, + "host": "2130706813", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.exclusive-lock:45234" + }, + "busyLock": { + "name": "_root_.autorest.busy-lock", + "options": { + "port": 37199, + "host": "2130756895", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.busy-lock:37199" + }, + "personalLock": { + "name": "_root_.autorest.1382.036574883898.personal-lock", + "options": { + "port": 55913, + "host": "2130709233", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.1382.036574883898.personal-lock:55913" + }, + "file": "/tmp/_root_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/root/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest.modeler", + "version": "2.3.38", + "dependencies": { + "dotnet-2.0.0": "^1.4.4" + }, + "optionalDependencies": {}, + "devDependencies": { + "@microsoft.azure/autorest.testserver": "2.3.1", + "autorest": "^2.0.4201", + "coffee-script": "^1.11.1", + "dotnet-sdk-2.0.0": "^1.4.4", + "gulp": "^3.9.1", + "gulp-filter": "^5.0.0", + "gulp-line-ending-corrector": "^1.0.1", + "iced-coffee-script": "^108.0.11", + "marked": "^0.3.6", + "marked-terminal": "^2.0.0", + "moment": "^2.17.1", + "run-sequence": "*", + "shx": "^0.2.2", + "through2-parallel": "^0.1.3", + "yargs": "^8.0.2", + "yarn": "^1.0.2" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/root/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler", + "_shasum": "903bb77932e4ed1b8bc3b25cc39b167143494f6c", + "_shrinkwrap": null, + "bin": null, + "_id": "@microsoft.azure/autorest.modeler@2.3.38", + "_from": "file:/root/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler", + "_requested": { + "type": "directory", + "where": "/git-restapi", + "raw": "/root/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler", + "rawSpec": "/root/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler", + "saveSpec": "file:/root/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler", + "fetchSpec": "/root/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler" + }, + "_spec": "/root/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler", + "_where": "/root/.autorest/@microsoft.azure_autorest.modeler@2.3.38/node_modules/@microsoft.azure/autorest.modeler" + }, + "extensionManager": { + "installationPath": "/root/.autorest", + "sharedLock": { + "name": "/root/.autorest", + "exclusiveLock": { + "name": "_root_.autorest.exclusive-lock", + "options": { + "port": 45234, + "host": "2130706813", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.exclusive-lock:45234" + }, + "busyLock": { + "name": "_root_.autorest.busy-lock", + "options": { + "port": 37199, + "host": "2130756895", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.busy-lock:37199" + }, + "personalLock": { + "name": "_root_.autorest.1382.036574883898.personal-lock", + "options": { + "port": 55913, + "host": "2130709233", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.1382.036574883898.personal-lock:55913" + }, + "file": "/tmp/_root_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/root/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest.python", + "version": "2.1.34", + "dependencies": { + "dotnet-2.0.0": "^1.4.4" + }, + "optionalDependencies": {}, + "devDependencies": { + "@microsoft.azure/autorest.testserver": "^2.3.13", + "autorest": "^2.0.4203", + "coffee-script": "^1.11.1", + "dotnet-sdk-2.0.0": "^1.4.4", + "gulp": "^3.9.1", + "gulp-filter": "^5.0.0", + "gulp-line-ending-corrector": "^1.0.1", + "iced-coffee-script": "^108.0.11", + "marked": "^0.3.6", + "marked-terminal": "^2.0.0", + "moment": "^2.17.1", + "run-sequence": "*", + "shx": "^0.2.2", + "through2-parallel": "^0.1.3", + "yargs": "^8.0.2", + "yarn": "^1.0.2" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/root/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python", + "_shasum": "b58d7e0542e081cf410fdbcdf8c14acf9cee16a7", + "_shrinkwrap": null, + "bin": null, + "_id": "@microsoft.azure/autorest.python@2.1.34", + "_from": "file:/root/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python", + "_requested": { + "type": "directory", + "where": "/git-restapi", + "raw": "/root/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python", + "rawSpec": "/root/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python", + "saveSpec": "file:/root/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python", + "fetchSpec": "/root/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python" + }, + "_spec": "/root/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python", + "_where": "/root/.autorest/@microsoft.azure_autorest.python@2.1.34/node_modules/@microsoft.azure/autorest.python" + }, + "extensionManager": { + "installationPath": "/root/.autorest", + "sharedLock": { + "name": "/root/.autorest", + "exclusiveLock": { + "name": "_root_.autorest.exclusive-lock", + "options": { + "port": 45234, + "host": "2130706813", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.exclusive-lock:45234" + }, + "busyLock": { + "name": "_root_.autorest.busy-lock", + "options": { + "port": 37199, + "host": "2130756895", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.busy-lock:37199" + }, + "personalLock": { + "name": "_root_.autorest.1382.036574883898.personal-lock", + "options": { + "port": 55913, + "host": "2130709233", + "exclusive": true + }, + "pipe": "/tmp/pipe__root_.autorest.1382.036574883898.personal-lock:55913" + }, + "file": "/tmp/_root_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/root/.autorest" + } + ], + "autorest_bootstrap": {} } \ No newline at end of file